You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "sakshichitnis27 (via GitHub)" <gi...@apache.org> on 2026/07/18 09:07:15 UTC
[PR] Document decimal AVG wrapping arithmetic [datafusion]
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Document decimal AVG wrapping arithmetic [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23685:
URL: https://github.com/apache/datafusion/pull/23685#issuecomment-5089985785
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/23685?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 80.67%. Comparing base ([`1734d4b`](https://app.codecov.io/gh/apache/datafusion/commit/1734d4beb4440b1cd34c4d22fbccd3ef9cac0808?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`2a20f66`](https://app.codecov.io/gh/apache/datafusion/commit/2a20f667a97e8b724e3bbc147cb8a9e462a40854?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 103 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #23685 +/- ##
==========================================
- Coverage 80.67% 80.67% -0.01%
==========================================
Files 1087 1087
Lines 367541 367562 +21
Branches 367541 367562 +21
==========================================
- Hits 296529 296528 -1
- Misses 53355 53377 +22
Partials 17657 17657
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/23685?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Document decimal AVG wrapping arithmetic [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #23685:
URL: https://github.com/apache/datafusion/pull/23685
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Document decimal AVG wrapping arithmetic [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #23685:
URL: https://github.com/apache/datafusion/pull/23685#issuecomment-5301948923
Thanks @AdamGS and @sakshichitnis27
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Document decimal AVG wrapping arithmetic [datafusion]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23685:
URL: https://github.com/apache/datafusion/pull/23685#issuecomment-5089765836
<!-- semver-check-comment -->
Thank you for opening this pull request!
Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).
<details>
<summary>Details</summary>
```
Cloning apache/main
Building datafusion-functions-aggregate v54.0.0 (current)
Built [ 37.256s] (current)
Parsing datafusion-functions-aggregate v54.0.0 (current)
Parsed [ 0.045s] (current)
Building datafusion-functions-aggregate v54.1.0 (baseline)
Built [ 31.048s] (baseline)
Parsing datafusion-functions-aggregate v54.1.0 (baseline)
Parsed [ 0.046s] (baseline)
Checking datafusion-functions-aggregate v54.1.0 -> v54.0.0 (minor change)
Checked [ 0.177s] 196 checks: 193 pass, 3 fail, 0 warn, 57 skip
--- failure function_missing: pub fn removed or renamed ---
Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/function_missing.ron
Failed in:
function datafusion_functions_aggregate::any_value::any_value_udaf, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate/src/any_value.rs:35
function datafusion_functions_aggregate::any_value::any_value, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate/src/any_value.rs:35
function datafusion_functions_aggregate::expr_fn::any_value, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate/src/any_value.rs:35
--- failure module_missing: pub module removed or renamed ---
Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/module_missing.ron
Failed in:
mod datafusion_functions_aggregate::any_value, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate/src/any_value.rs:18
--- failure struct_missing: pub struct removed or renamed ---
Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/struct_missing.ron
Failed in:
struct datafusion_functions_aggregate::any_value::AnyValue, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate/src/any_value.rs:58
Summary semver requires new major version: 3 major and 0 minor checks failed
Finished [ 69.918s] datafusion-functions-aggregate
Building datafusion-functions-aggregate-common v54.0.0 (current)
Built [ 20.152s] (current)
Parsing datafusion-functions-aggregate-common v54.0.0 (current)
Parsed [ 0.019s] (current)
Building datafusion-functions-aggregate-common v54.1.0 (baseline)
Built [ 20.098s] (baseline)
Parsing datafusion-functions-aggregate-common v54.1.0 (baseline)
Parsed [ 0.023s] (baseline)
Checking datafusion-functions-aggregate-common v54.1.0 -> v54.0.0 (minor change)
Checked [ 0.137s] 196 checks: 195 pass, 1 fail, 0 warn, 57 skip
--- failure inherent_method_missing: pub method removed or renamed ---
Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/inherent_method_missing.ron
Failed in:
TDigest::sum, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate-common/src/tdigest.rs:153
TDigest::centroids, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate-common/src/tdigest.rs:164
TDigest::try_from_parts, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/8dfbc4f40d9a252caaadaee84af92dcb3602afc2/datafusion/functions-aggregate-common/src/tdigest.rs:655
Summary semver requires new major version: 1 major and 0 minor checks failed
Finished [ 41.221s] datafusion-functions-aggregate-common
```
</details>
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Document decimal AVG wrapping arithmetic [datafusion]
Posted by "AdamGS (via GitHub)" <gi...@apache.org>.
AdamGS commented on PR #23685:
URL: https://github.com/apache/datafusion/pull/23685#issuecomment-5294701928
@sakshichitnis27 thank you for your contribution! sorry for taking so long, I lost track of this PR.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org