2020use arrow_array:: cast:: * ;
2121use arrow_array:: iterator:: ArrayIter ;
2222use arrow_array:: * ;
23- use arrow_buffer:: { ArrowNativeType , NullBuffer } ;
23+ use arrow_buffer:: NullBuffer ;
2424use arrow_data:: bit_iterator:: try_for_each_valid_idx;
2525use arrow_schema:: * ;
2626use std:: borrow:: BorrowMut ;
@@ -541,11 +541,9 @@ pub fn min_string_view(array: &StringViewArray) -> Option<&str> {
541541///
542542/// This doesn't detect overflow. Once overflowing, the result will wrap around.
543543/// For an overflow-checking variant, use [`sum_array_checked`] instead.
544- pub fn sum_array < T , A : ArrayAccessor < Item = T :: Native > > ( array : A ) -> Option < T :: Native >
545- where
546- T : ArrowNumericType ,
547- T :: Native : ArrowNativeTypeOp ,
548- {
544+ pub fn sum_array < T : ArrowNumericType , A : ArrayAccessor < Item = T :: Native > > (
545+ array : A ,
546+ ) -> Option < T :: Native > {
549547 match array. data_type ( ) {
550548 DataType :: Dictionary ( _, _) => {
551549 let null_count = array. null_count ( ) ;
@@ -583,13 +581,9 @@ where
583581/// use [`sum_array`] instead.
584582/// Additionally returns an `Err` on run-end-encoded arrays with a provided
585583/// values type parameter that is incorrect.
586- pub fn sum_array_checked < T , A : ArrayAccessor < Item = T :: Native > > (
584+ pub fn sum_array_checked < T : ArrowNumericType , A : ArrayAccessor < Item = T :: Native > > (
587585 array : A ,
588- ) -> Result < Option < T :: Native > , ArrowError >
589- where
590- T : ArrowNumericType ,
591- T :: Native : ArrowNativeTypeOp ,
592- {
586+ ) -> Result < Option < T :: Native > , ArrowError > {
593587 match array. data_type ( ) {
594588 DataType :: Dictionary ( _, _) => {
595589 let null_count = array. null_count ( ) ;
@@ -717,21 +711,17 @@ mod ree {
717711
718712/// Returns the min of values in the array of `ArrowNumericType` type, or dictionary
719713/// array with value of `ArrowNumericType` type.
720- pub fn min_array < T , A : ArrayAccessor < Item = T :: Native > > ( array : A ) -> Option < T :: Native >
721- where
722- T : ArrowNumericType ,
723- T :: Native : ArrowNativeType ,
724- {
714+ pub fn min_array < T : ArrowNumericType , A : ArrayAccessor < Item = T :: Native > > (
715+ array : A ,
716+ ) -> Option < T :: Native > {
725717 min_max_array_helper :: < T , A , _ , _ > ( array, |a, b| a. is_gt ( * b) , min)
726718}
727719
728720/// Returns the max of values in the array of `ArrowNumericType` type, or dictionary
729721/// array with value of `ArrowNumericType` type.
730- pub fn max_array < T , A : ArrayAccessor < Item = T :: Native > > ( array : A ) -> Option < T :: Native >
731- where
732- T : ArrowNumericType ,
733- T :: Native : ArrowNativeTypeOp ,
734- {
722+ pub fn max_array < T : ArrowNumericType , A : ArrayAccessor < Item = T :: Native > > (
723+ array : A ,
724+ ) -> Option < T :: Native > {
735725 min_max_array_helper :: < T , A , _ , _ > ( array, |a, b| a. is_lt ( * b) , max)
736726}
737727
@@ -874,11 +864,9 @@ pub fn bool_or(array: &BooleanArray) -> Option<bool> {
874864///
875865/// This detects overflow and returns an `Err` for that. For an non-overflow-checking variant,
876866/// use [`sum`] instead.
877- pub fn sum_checked < T > ( array : & PrimitiveArray < T > ) -> Result < Option < T :: Native > , ArrowError >
878- where
879- T : ArrowNumericType ,
880- T :: Native : ArrowNativeTypeOp ,
881- {
867+ pub fn sum_checked < T : ArrowNumericType > (
868+ array : & PrimitiveArray < T > ,
869+ ) -> Result < Option < T :: Native > , ArrowError > {
882870 let null_count = array. null_count ( ) ;
883871
884872 if null_count == array. len ( ) {
@@ -922,10 +910,7 @@ where
922910///
923911/// This doesn't detect overflow in release mode by default. Once overflowing, the result will
924912/// wrap around. For an overflow-checking variant, use [`sum_checked`] instead.
925- pub fn sum < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native >
926- where
927- T :: Native : ArrowNativeTypeOp ,
928- {
913+ pub fn sum < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native > {
929914 aggregate :: < T :: Native , T , SumAccumulator < T :: Native > > ( array)
930915}
931916
@@ -940,10 +925,7 @@ where
940925/// let result = min(&array);
941926/// assert_eq!(result, Some(2));
942927/// ```
943- pub fn min < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native >
944- where
945- T :: Native : PartialOrd ,
946- {
928+ pub fn min < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native > {
947929 aggregate :: < T :: Native , T , MinAccumulator < T :: Native > > ( array)
948930}
949931
@@ -958,10 +940,7 @@ where
958940/// let result = max(&array);
959941/// assert_eq!(result, Some(8));
960942/// ```
961- pub fn max < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native >
962- where
963- T :: Native : PartialOrd ,
964- {
943+ pub fn max < T : ArrowNumericType > ( array : & PrimitiveArray < T > ) -> Option < T :: Native > {
965944 aggregate :: < T :: Native , T , MaxAccumulator < T :: Native > > ( array)
966945}
967946
0 commit comments