Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unused type parameters. #3986

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions arrow-ord/src/ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(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());

Expand Down Expand Up @@ -229,8 +226,8 @@ pub fn build_compare(
(Duration(Nanosecond), Duration(Nanosecond)) => {
compare_primitives::<DurationNanosecondType>(left, right)
}
(Utf8, Utf8) => compare_string::<i32>(left, right),
(LargeUtf8, LargeUtf8) => compare_string::<i64>(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),
Expand Down
88 changes: 31 additions & 57 deletions arrow-ord/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,62 +271,38 @@ pub fn sort_to_indices(
}
DataType::Utf8 => sort_string::<i32>(values, v, n, &options, limit),
DataType::LargeUtf8 => sort_string::<i64>(values, v, n, &options, limit),
DataType::List(field) | DataType::FixedSizeList(field, _) => match field
.data_type()
{
DataType::Int8 => sort_list::<i32, Int8Type>(values, v, n, &options, limit),
DataType::Int16 => sort_list::<i32, Int16Type>(values, v, n, &options, limit),
DataType::Int32 => sort_list::<i32, Int32Type>(values, v, n, &options, limit),
DataType::Int64 => sort_list::<i32, Int64Type>(values, v, n, &options, limit),
DataType::UInt8 => sort_list::<i32, UInt8Type>(values, v, n, &options, limit),
DataType::UInt16 => {
sort_list::<i32, UInt16Type>(values, v, n, &options, limit)
}
DataType::UInt32 => {
sort_list::<i32, UInt32Type>(values, v, n, &options, limit)
}
DataType::UInt64 => {
sort_list::<i32, UInt64Type>(values, v, n, &options, limit)
}
DataType::Float16 => {
sort_list::<i32, Float16Type>(values, v, n, &options, limit)
}
DataType::Float32 => {
sort_list::<i32, Float32Type>(values, v, n, &options, limit)
}
DataType::Float64 => {
sort_list::<i32, Float64Type>(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::<i32>(values, v, n, &options, limit),
DataType::Int16 => sort_list::<i32>(values, v, n, &options, limit),
DataType::Int32 => sort_list::<i32>(values, v, n, &options, limit),
DataType::Int64 => sort_list::<i32>(values, v, n, &options, limit),
DataType::UInt8 => sort_list::<i32>(values, v, n, &options, limit),
DataType::UInt16 => sort_list::<i32>(values, v, n, &options, limit),
DataType::UInt32 => sort_list::<i32>(values, v, n, &options, limit),
DataType::UInt64 => sort_list::<i32>(values, v, n, &options, limit),
DataType::Float16 => sort_list::<i32>(values, v, n, &options, limit),
DataType::Float32 => sort_list::<i32>(values, v, n, &options, limit),
DataType::Float64 => sort_list::<i32>(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::<i64, Int8Type>(values, v, n, &options, limit),
DataType::Int16 => sort_list::<i64, Int16Type>(values, v, n, &options, limit),
DataType::Int32 => sort_list::<i64, Int32Type>(values, v, n, &options, limit),
DataType::Int64 => sort_list::<i64, Int64Type>(values, v, n, &options, limit),
DataType::UInt8 => sort_list::<i64, UInt8Type>(values, v, n, &options, limit),
DataType::UInt16 => {
sort_list::<i64, UInt16Type>(values, v, n, &options, limit)
}
DataType::UInt32 => {
sort_list::<i64, UInt32Type>(values, v, n, &options, limit)
}
DataType::UInt64 => {
sort_list::<i64, UInt64Type>(values, v, n, &options, limit)
}
DataType::Float16 => {
sort_list::<i64, Float16Type>(values, v, n, &options, limit)
}
DataType::Float32 => {
sort_list::<i64, Float32Type>(values, v, n, &options, limit)
}
DataType::Float64 => {
sort_list::<i64, Float64Type>(values, v, n, &options, limit)
}
DataType::Int8 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Int16 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Int32 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Int64 => sort_list::<i64>(values, v, n, &options, limit),
DataType::UInt8 => sort_list::<i64>(values, v, n, &options, limit),
DataType::UInt16 => sort_list::<i64>(values, v, n, &options, limit),
DataType::UInt32 => sort_list::<i64>(values, v, n, &options, limit),
DataType::UInt64 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Float16 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Float32 => sort_list::<i64>(values, v, n, &options, limit),
DataType::Float64 => sort_list::<i64>(values, v, n, &options, limit),
t => {
return Err(ArrowError::ComputeError(format!(
"Sort not supported for list type {t:?}"
Expand Down Expand Up @@ -901,7 +877,7 @@ where
}
}

fn sort_list<S, T>(
fn sort_list<S>(
values: &dyn Array,
value_indices: Vec<u32>,
null_indices: Vec<u32>,
Expand All @@ -910,8 +886,6 @@ fn sort_list<S, T>(
) -> UInt32Array
where
S: OffsetSizeTrait,
T: ArrowPrimitiveType,
T::Native: PartialOrd,
{
sort_list_inner::<S>(values, value_indices, null_indices, options, limit)
}
Expand Down