leung-ming commented on code in PR #1922:
URL: https://github.com/apache/datafusion-comet/pull/1922#discussion_r2165657752
##########
native/spark-expr/src/agg_funcs/sum_decimal.rs:
##########
@@ -375,11 +375,17 @@ impl GroupsAccumulator for SumDecimalGroupsAccumulator {
// are null, in this case we'll return null
// 2. if `is_empty` is false, but `null_state` is true, it means
there's an overflow. In
// non-ANSI mode Spark returns null.
+ let result = emit_to.take_needed(&mut self.sum);
+ result.iter().enumerate().for_each(|(i, &v)| {
Review Comment:
Partial aggregate.
Use the test as example:
Two numbers 42 and 9*9 are parted.
```rust
part_1.update(42) // ok, 42
part_2.update(9*9) // ok, 9*9
// gather exchange
final.merge(part_1); final.merge(part_2) // overflow without setting nulls
final.evaluate() // overflowed value returned, spark throw
```
BTW, some time 9*9 and 42 are not parted, in that case sum will work, but
avg will fail, I am not yet put it to test though.
```rust
avg.update(42) // ok, 42
avg.update(9*9) // new_sum overflow, sum is still 42 and count is 2 and null
bit is set
avg.evaluate() // the evaluate of avg without checking the null bit,
yielding 21
```
There maybe other issue in avg, to be fixed later with #1893
--
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]