alamb commented on code in PR #2375:
URL: https://github.com/apache/arrow-datafusion/pull/2375#discussion_r867037033


##########
datafusion/physical-expr/src/aggregate/sum.rs:
##########
@@ -144,7 +173,8 @@ fn sum_decimal_batch(
 }
 
 // sums the array and returns a ScalarValue of its corresponding type.
-pub(crate) fn sum_batch(values: &ArrayRef) -> Result<ScalarValue> {
+pub(crate) fn sum_batch(values: &ArrayRef, sum_type: &DataType) -> 
Result<ScalarValue> {
+    let values = &cast(values, sum_type)?;

Review Comment:
   I also wonder if we could internally consider summing smaller integers using 
u128  and then detecting overflow at the end. 🤔 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to