Skip to content

Remove GroupsAccumulator::supports_convert_to_state and require convert_to_state - #23489

Merged
Dandandan merged 4 commits into
apache:mainfrom
lyne7-sc:remove-groups-accumulator-support-flag
Jul 24, 2026
Merged

Remove GroupsAccumulator::supports_convert_to_state and require convert_to_state#23489
Dandandan merged 4 commits into
apache:mainfrom
lyne7-sc:remove-groups-accumulator-support-flag

Conversation

@lyne7-sc

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Following #23275, all GroupsAccumulator implementations now provide convert_to_state.

The supports_convert_to_state capability flag is therefore no longer needed.

What changes are included in this PR?

  • Make GroupsAccumulator::convert_to_state a required trait method.

  • Remove GroupsAccumulator::supports_convert_to_state and its implementations.

  • Remove the corresponding capability checks from hash aggregation.

  • Simplify skip-partial aggregation to use the required convert_to_state implementation directly.

  • Add a regression test covering the partial hash aggregation skip path.

  • Document the breaking trait change in the 55.0.0 upgrading guide.

  • Remove FFI_GroupsAccumulator::supports_convert_to_state. This changes the FFI ABI layout, so providers and consumers must be rebuilt against DataFusion 55.

Are these changes tested?

Yes. Added a regression test verifying that skip-partial aggregation uses the required convert_to_state implementation without a capability flag.

Existing physical-plan and FFI tests continue to pass.

Are there any user-facing changes?

Yes. This is a breaking Rust API change for external GroupsAccumulator implementations:

  • convert_to_state must now be implemented.
  • supports_convert_to_state should be removed.

The migration is documented in the 55.0.0 upgrading guide.

The FFI_GroupsAccumulator layout has changed. FFI providers and consumers must be rebuilt against DataFusion 55 and must not exchange this struct with older major versions.

@github-actions github-actions Bot added documentation Improvements or additions to documentation logical-expr Logical plan and expressions core Core DataFusion crate functions Changes to functions implementation ffi Changes to the ffi crate physical-plan Changes to the physical-plan crate spark labels Jul 12, 2026
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: 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
     Cloning apache/main
    Building datafusion v54.1.0 (current)
       Built [ 103.975s] (current)
     Parsing datafusion v54.1.0 (current)
      Parsed [   0.034s] (current)
    Building datafusion v54.1.0 (baseline)
       Built [ 102.667s] (baseline)
     Parsing datafusion v54.1.0 (baseline)
      Parsed [   0.034s] (baseline)
    Checking datafusion v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.600s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [ 209.162s] datafusion
    Building datafusion-expr-common v54.1.0 (current)
       Built [  18.537s] (current)
     Parsing datafusion-expr-common v54.1.0 (current)
      Parsed [   0.019s] (current)
    Building datafusion-expr-common v54.1.0 (baseline)
       Built [  18.757s] (baseline)
     Parsing datafusion-expr-common v54.1.0 (baseline)
      Parsed [   0.020s] (baseline)
    Checking datafusion-expr-common v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.206s] 223 checks: 221 pass, 2 fail, 0 warn, 30 skip

--- failure trait_method_default_impl_removed: pub trait default method impl removed ---

Description:
A method's default impl in an unsealed trait has been removed, breaking trait implementations that relied on that default
        ref: https://doc.rust-lang.org/book/ch10-02-traits.html#default-implementations
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/trait_method_default_impl_removed.ron

Failed in:
  trait method datafusion_expr_common::groups_accumulator::GroupsAccumulator::convert_to_state in file /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/groups_accumulator.rs:232

--- failure trait_method_missing: pub trait method removed or renamed ---

Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/trait_method_missing.ron

Failed in:
  method supports_convert_to_state of trait GroupsAccumulator, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/e22e781a5f076e5bb174994a29ad4d334d6f6795/datafusion/expr-common/src/groups_accumulator.rs:242

     Summary semver requires new major version: 2 major and 0 minor checks failed
    Finished [  39.011s] datafusion-expr-common
    Building datafusion-ffi v54.1.0 (current)
       Built [  58.763s] (current)
     Parsing datafusion-ffi v54.1.0 (current)
      Parsed [   0.059s] (current)
    Building datafusion-ffi v54.1.0 (baseline)
       Built [  58.643s] (baseline)
     Parsing datafusion-ffi v54.1.0 (baseline)
      Parsed [   0.060s] (baseline)
    Checking datafusion-ffi v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.228s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [ 119.325s] datafusion-ffi
    Building datafusion-functions-aggregate v54.1.0 (current)
       Built [  30.475s] (current)
     Parsing datafusion-functions-aggregate v54.1.0 (current)
      Parsed [   0.044s] (current)
    Building datafusion-functions-aggregate v54.1.0 (baseline)
       Built [  31.051s] (baseline)
     Parsing datafusion-functions-aggregate v54.1.0 (baseline)
      Parsed [   0.046s] (baseline)
    Checking datafusion-functions-aggregate v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.194s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  62.821s] datafusion-functions-aggregate
    Building datafusion-functions-aggregate-common v54.1.0 (current)
       Built [  19.950s] (current)
     Parsing datafusion-functions-aggregate-common v54.1.0 (current)
      Parsed [   0.018s] (current)
    Building datafusion-functions-aggregate-common v54.1.0 (baseline)
       Built [  20.247s] (baseline)
     Parsing datafusion-functions-aggregate-common v54.1.0 (baseline)
      Parsed [   0.018s] (baseline)
    Checking datafusion-functions-aggregate-common v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.146s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  41.751s] datafusion-functions-aggregate-common
    Building datafusion-physical-plan v54.1.0 (current)
       Built [  36.300s] (current)
     Parsing datafusion-physical-plan v54.1.0 (current)
      Parsed [   0.138s] (current)
    Building datafusion-physical-plan v54.1.0 (baseline)
       Built [  36.078s] (baseline)
     Parsing datafusion-physical-plan v54.1.0 (baseline)
      Parsed [   0.139s] (baseline)
    Checking datafusion-physical-plan v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.583s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  74.409s] datafusion-physical-plan
    Building datafusion-spark v54.1.0 (current)
       Built [  56.923s] (current)
     Parsing datafusion-spark v54.1.0 (current)
      Parsed [   0.059s] (current)
    Building datafusion-spark v54.1.0 (baseline)
       Built [  57.292s] (baseline)
     Parsing datafusion-spark v54.1.0 (baseline)
      Parsed [   0.063s] (baseline)
    Checking datafusion-spark v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.320s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [ 116.203s] datafusion-spark

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Jul 12, 2026
@codecov-commenter

codecov-commenter commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.66667% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.74%. Comparing base (050046a) to head (4efdd80).
⚠️ Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/physical-plan/src/aggregates/mod.rs 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23489      +/-   ##
==========================================
+ Coverage   80.71%   80.74%   +0.03%     
==========================================
  Files        1089     1089              
  Lines      368750   368736      -14     
  Branches   368750   368736      -14     
==========================================
+ Hits       297631   297739     +108     
+ Misses      53375    53242     -133     
- Partials    17744    17755      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lyne7-sc

Copy link
Copy Markdown
Contributor Author

Hi @alamb, could you take a look at this? Thanks!

Since all GroupsAccumulator implementations now provide convert_to_state, I believe supports_convert_to_state can be safely removed as it's no longer needed.

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @lyne7-sc -- thank you 🙏

I don't understand what extra coverage partial_hash_skip_aggregation_uses_required_convert_to_state is adding

This PR's descripton says

Add a regression test covering the partial hash aggregation skip path.

But the partial aggregation skip path is already covered (via slt and elsewhere). Specifically here

Unit testsdatafusion/physical-plan/src/aggregates/mod.rs

}

#[tokio::test]
async fn partial_hash_skip_aggregation_uses_required_convert_to_state() -> Result<()>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what extra coverage this is adding -- if we are testing partial state conversion I think we should write the tests using sql in sqllogictests. This test has a lot of setup and like I mentioned I am not sure about its coverage value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for pointing this out. I missed test_partial_hash_stream_skip_aggregation_after_first_batch. It already provides very similar coverage of the skip-partial path, so I’ve removed the redundant test.

`datafusion_expr_common::groups_accumulator::GroupsAccumulator::convert_to_state`
no longer provides a default implementation, and the
`GroupsAccumulator::supports_convert_to_state` capability method has been
removed. All `GroupsAccumulator` implementations must now support converting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Dandandan
Dandandan added this pull request to the merge queue Jul 24, 2026
Merged via the queue into apache:main with commit 3f81613 Jul 24, 2026
41 checks passed
@alamb

alamb commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🚀

@lyne7-sc
lyne7-sc deleted the remove-groups-accumulator-support-flag branch July 27, 2026 06:29
kosiew pushed a commit to kosiew/datafusion that referenced this pull request Aug 12, 2026
…nvert_to_state` (apache#23489)

## 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 apache#123` indicates that this PR will close issue apache#123.
-->

- Closes apache#23081.

## 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.
-->

Following apache#23275, all `GroupsAccumulator` implementations now provide
`convert_to_state`.

The `supports_convert_to_state` capability flag is therefore no longer
needed.

## 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.
-->

- Make `GroupsAccumulator::convert_to_state` a required trait method.
- Remove `GroupsAccumulator::supports_convert_to_state` and its
implementations.
- Remove the corresponding capability checks from hash aggregation.
- Simplify skip-partial aggregation to use the required
`convert_to_state` implementation directly.
- Add a regression test covering the partial hash aggregation skip path.
- Document the breaking trait change in the 55.0.0 upgrading guide.

- Remove `FFI_GroupsAccumulator::supports_convert_to_state`. This
changes the FFI ABI layout, so providers and consumers must be rebuilt
against DataFusion 55.

## 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)?
-->

Yes. Added a regression test verifying that skip-partial aggregation
uses the required `convert_to_state` implementation without a capability
flag.

Existing physical-plan and FFI tests continue to pass.

## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->

Yes. This is a breaking Rust API change for external `GroupsAccumulator`
implementations:

- `convert_to_state` must now be implemented.
- `supports_convert_to_state` should be removed.

The migration is documented in the 55.0.0 upgrading guide.

The `FFI_GroupsAccumulator` layout has changed. FFI providers and
consumers must be rebuilt against DataFusion 55 and must not exchange
this struct with older major versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change core Core DataFusion crate documentation Improvements or additions to documentation ffi Changes to the ffi crate functions Changes to functions implementation logical-expr Logical plan and expressions physical-plan Changes to the physical-plan crate spark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove GroupsAccumulator::supports_convert_to_state and make convert_to_state mandatory

4 participants