sakshichitnis27 opened a new pull request, #23685:
URL: https://github.com/apache/datafusion/pull/23685
## Which issue does this PR close?
- Closes #23665
## Rationale for this change
Decimal AVG intentionally uses wrapping arithmetic with a widened
intermediate sum type. The existing direct `add_wrapping` and `sub_wrapping`
calls made that invariant difficult to audit.
## What changes are included in this PR?
- Added small private helpers documenting the widened/headroom contract.
- Updated scalar, grouped, merge, retract, and `AVG(DISTINCT)` decimal
paths to use the helpers.
- Kept the existing state types, return types, and arithmetic behavior
unchanged.
## Are these changes tested?
- `cargo fmt --all -- --check`
- `cargo test -p datafusion-functions-aggregate avg
--lib`
- `cargo test -p datafusion-functions-aggregate-common
avg_distinct --lib`
- `cargo clippy -p datafusion-functions-aggregate-common
--all-targets -- -D warnings`
## Are there any user-facing changes?
No.
--
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]