yjshen commented on code in PR #2375:
URL: https://github.com/apache/arrow-datafusion/pull/2375#discussion_r866742045
##########
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:
This is the partial fix for #2455. We should cast the input array to sum
result datatype first to alleviate the possibility of overflow. Further, we
should have a wrapping sum kernel as well as a try_sum kernel to produce
wrapped results or nulls in the case of overflow.
--
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]