Skip to content

fix: give reset copies of AggregateExec their own dynamic filter - #27453

Open
raghavyadav01 wants to merge 1 commit into
apache:mainfrom
raghavyadav01:fix/agg-dynfilter-reset-copies
Open

raghavyadav01 wants to merge 1 commit into
apache:mainfrom
raghavyadav01:fix/agg-dynfilter-reset-copies

Conversation

@raghavyadav01

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

AggregateExec::reset_state resets its MIN/MAX dynamic filter in place and then clones the node, so every copy made with reset_plan_states shares one filter and one set of bounds. A copy that runs after another one starts from the bound the first one left and prunes row groups it still needs (max returns NULL, or 900 when copies run at the same time). #27142 fixed the same thing for SortExec.

What changes are included in this PR?

Are these changes tested?

Yes, in core/tests/execution/agg_dynamic_filter_reset.rs:

  • reset_copies_have_independent_aggregate_dynamic_filters: two copies run one after the other, then 10 rounds of concurrent copies. It fails on main (NULL instead of 1000).
  • rerun_after_reset_keeps_aggregate_result: run, reset, run gives the same result. It already passes on main; it guards the in-place reset this change keeps.

I also ran the aggregate unit tests in physical-plan, the dynamic filter and filter pushdown tests in core_integration, the related sqllogictest files, and clippy.

Are there any user-facing changes?

No API changes. Reset copies of a plan with a MIN/MAX aggregate return correct results, and lose that aggregate's dynamic row-group pruning.

I used Claude Code to help reproduce the issue and write the change. I reviewed and tested it myself.

🤖 Generated with Claude Code

AggregateExec::reset_state reset its MIN/MAX dynamic filter in place and
then cloned the node, so every copy made by reset_plan_states shared one
filter and one set of bounds. A copy that ran after another one pruned row
groups it still needed and could return NULL.

Keep clearing the old filter in place (the scan below still holds it), then
give the copy a new filter and new bounds, as SortExec does since apache#27142.

Closes apache#27452.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Raghav Yadav <[email protected]>
@github-actions github-actions Bot added core Core DataFusion crate physical-plan Changes to the physical-plan crate labels Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AggregateExec dynamic filter is shared across reset_plan_states copies

1 participant