File tree Expand file tree Collapse file tree
datafusion/physical-expr/src/aggregate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,21 +161,10 @@ macro_rules! typed_sum_delta_batch {
161161 } } ;
162162}
163163
164- // TODO implement this in arrow-rs with simd
165- // https://github.com/apache/arrow-rs/issues/1010
166164fn sum_decimal_batch ( values : & ArrayRef , precision : u8 , scale : i8 ) -> Result < ScalarValue > {
167165 let array = downcast_value ! ( values, Decimal128Array ) ;
168-
169- if array. null_count ( ) == array. len ( ) {
170- return Ok ( ScalarValue :: Decimal128 ( None , precision, scale) ) ;
171- }
172-
173- let result = array. into_iter ( ) . fold ( 0_i128 , |s, element| match element {
174- Some ( v) => s + v,
175- None => s,
176- } ) ;
177-
178- Ok ( ScalarValue :: Decimal128 ( Some ( result) , precision, scale) )
166+ let result = compute:: sum ( array) ;
167+ Ok ( ScalarValue :: Decimal128 ( result, precision, scale) )
179168}
180169
181170// sums the array and returns a ScalarValue of its corresponding type.
You can’t perform that action at this time.
0 commit comments