diff --git a/arrow-arith/src/aggregate.rs b/arrow-arith/src/aggregate.rs index 59792d0c5b1d..8745c779ce0a 100644 --- a/arrow-arith/src/aggregate.rs +++ b/arrow-arith/src/aggregate.rs @@ -20,7 +20,7 @@ use arrow_array::cast::*; use arrow_array::iterator::ArrayIter; use arrow_array::*; -use arrow_buffer::{ArrowNativeType, NullBuffer}; +use arrow_buffer::NullBuffer; use arrow_data::bit_iterator::try_for_each_valid_idx; use arrow_schema::*; use std::borrow::BorrowMut; @@ -541,11 +541,9 @@ pub fn min_string_view(array: &StringViewArray) -> Option<&str> { /// /// This doesn't detect overflow. Once overflowing, the result will wrap around. /// For an overflow-checking variant, use [`sum_array_checked`] instead. -pub fn sum_array>(array: A) -> Option -where - T: ArrowNumericType, - T::Native: ArrowNativeTypeOp, -{ +pub fn sum_array>( + array: A, +) -> Option { match array.data_type() { DataType::Dictionary(_, _) => { let null_count = array.null_count(); @@ -583,13 +581,9 @@ where /// use [`sum_array`] instead. /// Additionally returns an `Err` on run-end-encoded arrays with a provided /// values type parameter that is incorrect. -pub fn sum_array_checked>( +pub fn sum_array_checked>( array: A, -) -> Result, ArrowError> -where - T: ArrowNumericType, - T::Native: ArrowNativeTypeOp, -{ +) -> Result, ArrowError> { match array.data_type() { DataType::Dictionary(_, _) => { let null_count = array.null_count(); @@ -717,21 +711,17 @@ mod ree { /// Returns the min of values in the array of `ArrowNumericType` type, or dictionary /// array with value of `ArrowNumericType` type. -pub fn min_array>(array: A) -> Option -where - T: ArrowNumericType, - T::Native: ArrowNativeType, -{ +pub fn min_array>( + array: A, +) -> Option { min_max_array_helper::(array, |a, b| a.is_gt(*b), min) } /// Returns the max of values in the array of `ArrowNumericType` type, or dictionary /// array with value of `ArrowNumericType` type. -pub fn max_array>(array: A) -> Option -where - T: ArrowNumericType, - T::Native: ArrowNativeTypeOp, -{ +pub fn max_array>( + array: A, +) -> Option { min_max_array_helper::(array, |a, b| a.is_lt(*b), max) } @@ -874,11 +864,9 @@ pub fn bool_or(array: &BooleanArray) -> Option { /// /// This detects overflow and returns an `Err` for that. For an non-overflow-checking variant, /// use [`sum`] instead. -pub fn sum_checked(array: &PrimitiveArray) -> Result, ArrowError> -where - T: ArrowNumericType, - T::Native: ArrowNativeTypeOp, -{ +pub fn sum_checked( + array: &PrimitiveArray, +) -> Result, ArrowError> { let null_count = array.null_count(); if null_count == array.len() { @@ -922,10 +910,7 @@ where /// /// This doesn't detect overflow in release mode by default. Once overflowing, the result will /// wrap around. For an overflow-checking variant, use [`sum_checked`] instead. -pub fn sum(array: &PrimitiveArray) -> Option -where - T::Native: ArrowNativeTypeOp, -{ +pub fn sum(array: &PrimitiveArray) -> Option { aggregate::>(array) } @@ -940,10 +925,7 @@ where /// let result = min(&array); /// assert_eq!(result, Some(2)); /// ``` -pub fn min(array: &PrimitiveArray) -> Option -where - T::Native: PartialOrd, -{ +pub fn min(array: &PrimitiveArray) -> Option { aggregate::>(array) } @@ -958,10 +940,7 @@ where /// let result = max(&array); /// assert_eq!(result, Some(8)); /// ``` -pub fn max(array: &PrimitiveArray) -> Option -where - T::Native: PartialOrd, -{ +pub fn max(array: &PrimitiveArray) -> Option { aggregate::>(array) } diff --git a/arrow-arith/src/arithmetic.rs b/arrow-arith/src/arithmetic.rs index 27efed6fcdb4..e8539c64b1ad 100644 --- a/arrow-arith/src/arithmetic.rs +++ b/arrow-arith/src/arithmetic.rs @@ -170,11 +170,7 @@ pub fn multiply_fixed_point( } /// Divide a decimal native value by given divisor and round the result. -fn divide_and_round(input: I::Native, div: I::Native) -> I::Native -where - I: DecimalType, - I::Native: ArrowNativeTypeOp, -{ +fn divide_and_round(input: I::Native, div: I::Native) -> I::Native { let d = input.div_wrapping(div); let r = input.mod_wrapping(div); diff --git a/arrow-cast/src/cast/decimal.rs b/arrow-cast/src/cast/decimal.rs index f8fe06a573de..3553f2b6a76f 100644 --- a/arrow-cast/src/cast/decimal.rs +++ b/arrow-cast/src/cast/decimal.rs @@ -812,7 +812,7 @@ where T: ArrowPrimitiveType, ::Native: NumCast, D: DecimalType + ArrowPrimitiveType, - ::Native: ArrowNativeTypeOp + ToPrimitive, + ::Native: ToPrimitive, { let array = array.as_primitive::(); diff --git a/arrow-cast/src/cast/mod.rs b/arrow-cast/src/cast/mod.rs index 9f1eba1057fd..e8d1740ae2e7 100644 --- a/arrow-cast/src/cast/mod.rs +++ b/arrow-cast/src/cast/mod.rs @@ -2287,7 +2287,7 @@ fn cast_from_decimal( ) -> Result where D: DecimalType + ArrowPrimitiveType, - ::Native: ArrowNativeTypeOp + ToPrimitive, + ::Native: ToPrimitive, F: Fn(D::Native) -> f64, { use DataType::*; diff --git a/arrow-ord/src/ord.rs b/arrow-ord/src/ord.rs index 5951a587888a..51ae3c4d762d 100644 --- a/arrow-ord/src/ord.rs +++ b/arrow-ord/src/ord.rs @@ -114,10 +114,7 @@ fn compare_primitive( left: &dyn Array, right: &dyn Array, opts: SortOptions, -) -> DynComparator -where - T::Native: ArrowNativeTypeOp, -{ +) -> DynComparator { let left = left.as_primitive::(); let right = right.as_primitive::(); let l_values = left.values().clone();