From f1437a0b6468fa1a4a2e5b1700fbb7a79dd2dd6a Mon Sep 17 00:00:00 2001 From: Yang Xiufeng Date: Fri, 31 Mar 2023 11:20:08 +0800 Subject: [PATCH] fix: remove unused type parameters. receive warning from cargo clippy. --- arrow-ord/src/ord.rs | 9 ++--- arrow-ord/src/sort.rs | 88 +++++++++++++++---------------------------- 2 files changed, 34 insertions(+), 63 deletions(-) diff --git a/arrow-ord/src/ord.rs b/arrow-ord/src/ord.rs index 66058907f15a..db1fff6d3e2f 100644 --- a/arrow-ord/src/ord.rs +++ b/arrow-ord/src/ord.rs @@ -45,10 +45,7 @@ fn compare_boolean(left: &dyn Array, right: &dyn Array) -> DynComparator { Box::new(move |i, j| left.value(i).cmp(&right.value(j))) } -fn compare_string(left: &dyn Array, right: &dyn Array) -> DynComparator -where - T: OffsetSizeTrait, -{ +fn compare_string(left: &dyn Array, right: &dyn Array) -> DynComparator { let left: StringArray = StringArray::from(left.data().clone()); let right: StringArray = StringArray::from(right.data().clone()); @@ -229,8 +226,8 @@ pub fn build_compare( (Duration(Nanosecond), Duration(Nanosecond)) => { compare_primitives::(left, right) } - (Utf8, Utf8) => compare_string::(left, right), - (LargeUtf8, LargeUtf8) => compare_string::(left, right), + (Utf8, Utf8) => compare_string(left, right), + (LargeUtf8, LargeUtf8) => compare_string(left, right), ( Dictionary(key_type_lhs, value_type_lhs), Dictionary(key_type_rhs, value_type_rhs), diff --git a/arrow-ord/src/sort.rs b/arrow-ord/src/sort.rs index 6e0becc36c67..71db4d9b973f 100644 --- a/arrow-ord/src/sort.rs +++ b/arrow-ord/src/sort.rs @@ -271,62 +271,38 @@ pub fn sort_to_indices( } DataType::Utf8 => sort_string::(values, v, n, &options, limit), DataType::LargeUtf8 => sort_string::(values, v, n, &options, limit), - DataType::List(field) | DataType::FixedSizeList(field, _) => match field - .data_type() - { - DataType::Int8 => sort_list::(values, v, n, &options, limit), - DataType::Int16 => sort_list::(values, v, n, &options, limit), - DataType::Int32 => sort_list::(values, v, n, &options, limit), - DataType::Int64 => sort_list::(values, v, n, &options, limit), - DataType::UInt8 => sort_list::(values, v, n, &options, limit), - DataType::UInt16 => { - sort_list::(values, v, n, &options, limit) - } - DataType::UInt32 => { - sort_list::(values, v, n, &options, limit) - } - DataType::UInt64 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float16 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float32 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float64 => { - sort_list::(values, v, n, &options, limit) - } - t => { - return Err(ArrowError::ComputeError(format!( - "Sort not supported for list type {t:?}" - ))); + DataType::List(field) | DataType::FixedSizeList(field, _) => { + match field.data_type() { + DataType::Int8 => sort_list::(values, v, n, &options, limit), + DataType::Int16 => sort_list::(values, v, n, &options, limit), + DataType::Int32 => sort_list::(values, v, n, &options, limit), + DataType::Int64 => sort_list::(values, v, n, &options, limit), + DataType::UInt8 => sort_list::(values, v, n, &options, limit), + DataType::UInt16 => sort_list::(values, v, n, &options, limit), + DataType::UInt32 => sort_list::(values, v, n, &options, limit), + DataType::UInt64 => sort_list::(values, v, n, &options, limit), + DataType::Float16 => sort_list::(values, v, n, &options, limit), + DataType::Float32 => sort_list::(values, v, n, &options, limit), + DataType::Float64 => sort_list::(values, v, n, &options, limit), + t => { + return Err(ArrowError::ComputeError(format!( + "Sort not supported for list type {t:?}" + ))); + } } - }, + } DataType::LargeList(field) => match field.data_type() { - DataType::Int8 => sort_list::(values, v, n, &options, limit), - DataType::Int16 => sort_list::(values, v, n, &options, limit), - DataType::Int32 => sort_list::(values, v, n, &options, limit), - DataType::Int64 => sort_list::(values, v, n, &options, limit), - DataType::UInt8 => sort_list::(values, v, n, &options, limit), - DataType::UInt16 => { - sort_list::(values, v, n, &options, limit) - } - DataType::UInt32 => { - sort_list::(values, v, n, &options, limit) - } - DataType::UInt64 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float16 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float32 => { - sort_list::(values, v, n, &options, limit) - } - DataType::Float64 => { - sort_list::(values, v, n, &options, limit) - } + DataType::Int8 => sort_list::(values, v, n, &options, limit), + DataType::Int16 => sort_list::(values, v, n, &options, limit), + DataType::Int32 => sort_list::(values, v, n, &options, limit), + DataType::Int64 => sort_list::(values, v, n, &options, limit), + DataType::UInt8 => sort_list::(values, v, n, &options, limit), + DataType::UInt16 => sort_list::(values, v, n, &options, limit), + DataType::UInt32 => sort_list::(values, v, n, &options, limit), + DataType::UInt64 => sort_list::(values, v, n, &options, limit), + DataType::Float16 => sort_list::(values, v, n, &options, limit), + DataType::Float32 => sort_list::(values, v, n, &options, limit), + DataType::Float64 => sort_list::(values, v, n, &options, limit), t => { return Err(ArrowError::ComputeError(format!( "Sort not supported for list type {t:?}" @@ -901,7 +877,7 @@ where } } -fn sort_list( +fn sort_list( values: &dyn Array, value_indices: Vec, null_indices: Vec, @@ -910,8 +886,6 @@ fn sort_list( ) -> UInt32Array where S: OffsetSizeTrait, - T: ArrowPrimitiveType, - T::Native: PartialOrd, { sort_list_inner::(values, value_indices, null_indices, options, limit) }