comphead commented on code in PR #2069:
URL: https://github.com/apache/datafusion-comet/pull/2069#discussion_r2255295963
##########
native/spark-expr/src/agg_funcs/sum_decimal.rs:
##########
@@ -287,24 +287,16 @@ impl SumDecimalGroupsAccumulator {
!self.is_empty.get_bit(index) && !self.is_not_null.get_bit(index)
}
+ #[inline]
fn update_single(&mut self, group_index: usize, value: i128) {
- if unlikely(self.is_overflow(group_index)) {
- // This means there's a overflow in decimal, so we will just skip
the rest
- // of the computation
- return;
- }
-
self.is_empty.set_bit(group_index, false);
let (new_sum, is_overflow) =
self.sum[group_index].overflowing_add(value);
+ self.sum[group_index] = new_sum;
- if is_overflow || !is_valid_decimal_precision(new_sum, self.precision)
{
+ if unlikely(is_overflow || !is_valid_decimal_precision(new_sum,
self.precision)) {
Review Comment:
Oh this `likely` indeed we do use in some places, which is still
questionable but not related to this PR.
@leung-ming would be great to see optimization numbers, and what would be
the output in case of overflow now?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]