Skip to content

Commit 1ec2a83

Browse files
authored
1 parent c759865 commit 1ec2a83

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

  • datafusion/physical-expr/src/aggregate

datafusion/physical-expr/src/aggregate/sum.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff 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
166164
fn 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.

0 commit comments

Comments
 (0)