This is an automated email from the ASF dual-hosted git repository.

dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ec2a8396 wip (#5167)
1ec2a8396 is described below

commit 1ec2a839645013cc9a2a4f78d8cadcec44d865e2
Author: Chao Sun <[email protected]>
AuthorDate: Fri Feb 3 00:21:39 2023 -0800

    wip (#5167)
---
 datafusion/physical-expr/src/aggregate/sum.rs | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/datafusion/physical-expr/src/aggregate/sum.rs 
b/datafusion/physical-expr/src/aggregate/sum.rs
index 8f78abfd5..2f92aa939 100644
--- a/datafusion/physical-expr/src/aggregate/sum.rs
+++ b/datafusion/physical-expr/src/aggregate/sum.rs
@@ -161,21 +161,10 @@ macro_rules! typed_sum_delta_batch {
     }};
 }
 
-// TODO implement this in arrow-rs with simd
-// https://github.com/apache/arrow-rs/issues/1010
 fn sum_decimal_batch(values: &ArrayRef, precision: u8, scale: i8) -> 
Result<ScalarValue> {
     let array = downcast_value!(values, Decimal128Array);
-
-    if array.null_count() == array.len() {
-        return Ok(ScalarValue::Decimal128(None, precision, scale));
-    }
-
-    let result = array.into_iter().fold(0_i128, |s, element| match element {
-        Some(v) => s + v,
-        None => s,
-    });
-
-    Ok(ScalarValue::Decimal128(Some(result), precision, scale))
+    let result = compute::sum(array);
+    Ok(ScalarValue::Decimal128(result, precision, scale))
 }
 
 // sums the array and returns a ScalarValue of its corresponding type.

Reply via email to