You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/01/08 17:36:38 UTC
[PR] perf: refactor sum int with specialized implementations for each eval_mode [WIP] [datafusion-comet]
andygrove opened a new pull request, #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Refactored `sum_int.rs` from a single accumulator with eval mode branches inside loops into 6 separate accumulator implementations:
Single-row accumulators:
- SumIntegerAccumulatorLegacy - uses wrapping arithmetic (no overflow checking)
- SumIntegerAccumulatorAnsi - uses checked arithmetic, returns error on overflow
- SumIntegerAccumulatorTry - uses checked arithmetic, returns None on overflow, tracks has_all_nulls
Groups accumulators:
- SumIntGroupsAccumulatorLegacy
- SumIntGroupsAccumulatorAnsi
- SumIntGroupsAccumulatorTry
Key changes:
- SumInteger::accumulator() and create_groups_accumulator() now use a match on eval_mode to instantiate the appropriate accumulator type
- Each accumulator has a dedicated inner update_sum function without any eval mode branching
- The Legacy/Ansi accumulators don't carry the has_all_nulls field since they don't need it
- Added helper methods like overflowed() and group_overflowed() for the Try variants to improve readability
## How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3755264204
@coderfender could you review?
--
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] perf: refactor sum int with specialized implementations for each eval_mode [WIP] [datafusion-comet]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3725087309
## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/3054?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 9.97%. Comparing base ([`f09f8af`](https://app.codecov.io/gh/apache/datafusion-comet/commit/f09f8af64c6599255e116a376f4f008f2fd63b43?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`26b852d`](https://app.codecov.io/gh/apache/datafusion-comet/commit/26b852d8a4c09f543cb8dc658a26ed77cad217c9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 832 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #3054 +/- ##
============================================
- Coverage 56.12% 9.97% -46.16%
+ Complexity 976 234 -742
============================================
Files 119 167 +48
Lines 11743 15508 +3765
Branches 2251 2549 +298
============================================
- Hits 6591 1547 -5044
- Misses 4012 13784 +9772
+ Partials 1140 177 -963
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/3054?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.
</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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3849662627
> > This approach creates a lot of code duplication, the difference being mostly in overflow handling. How about we have a trait say, OverflowStrategy, and then implementations of the overflow strategy for each eval mode. Then the implementation can just use the appropriate implementation while most of the code remains the same.
>
> If I understand correctly, you're suggesting a common implementation that invokes a dyn trait per row for overflow handling?
Good point. I also considered a macro based approach but that just makes the code very unreadable. I guess this approach should be okay.
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3838208274
This approach creates a lot of code duplication, the difference being mostly in overflow handling. How about we have a trait say, OverflowStrategy, and then implementations of the overflow strategy for each eval mode. Then the implementation can just use the appropriate implementation while most of the code remains the same.
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3841971400
> This approach creates a lot of code duplication, the difference being mostly in overflow handling. How about we have a trait say, OverflowStrategy, and then implementations of the overflow strategy for each eval mode. Then the implementation can just use the appropriate implementation while most of the code remains the same.
If I understand correctly, you're suggesting a common implementation that invokes a dyn trait per row for overflow handling?
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3801570012
@comphead could you review when you have time
--
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] perf: refactor sum int with specialized implementations for each eval_mode [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #3054:
URL: https://github.com/apache/datafusion-comet/pull/3054#issuecomment-3844721515
minor : I wonder if we could reuse `Add` in `checked_arithmetic.rs` like Spark to remove redundancy
--
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