Skip to content

Cherry pick #115487 to 26.6: Do not push a bucket while any input is still at it in GroupingAggregatedTransform - #115781

Merged
nickitat merged 8 commits into
backport/26.6/115487from
cherrypick/26.6/115487
Aug 31, 2026
Merged

nickitat merged 8 commits into
backport/26.6/115487from
cherrypick/26.6/115487

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #115487

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Aug 21, 2026
@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor Author

Dear @nickitat, @nihalzp, this cherry-pick PR has not been updated for 3d0h18m49s. Please resolve the conflicts to backport #115487, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity.

@nickitat

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

@CLAassistant

CLAassistant commented Aug 31, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@nickitat

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

The merge conflicts have been resolved. The cherry-pick branch now applies the everyLiveInputIsPastBucket fix on top of the 26.6 backport-compatible code:

  • MergingAggregatedMemoryEfficientTransform.cpp: backport branch code + everyLiveInputIsPastBucket function and updated condition
  • MergingAggregatedMemoryEfficientTransform.h: backport branch code + everyLiveInputIsPastBucket declaration
  • gtest_grouping_aggregated_transform_bucket_pushed_once.cpp: new test file (unchanged from original cherry-pick)

Submodule pointers and .gitmodules have been aligned to the 26.6 backport branch — there are no true 3-way merge conflicts remaining. GitHub may show mergeable_state: dirty for a few more minutes while it recomputes the merge check.

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

The merge conflicts are already resolved (addressed in the previous session). The cherry-pick branch (c89dacc5d) contains:

  • MergingAggregatedMemoryEfficientTransform.cpp: 26.6 backport-compatible code + everyLiveInputIsPastBucket function and updated push condition
  • MergingAggregatedMemoryEfficientTransform.h: 26.6 backport-compatible code + everyLiveInputIsPastBucket declaration
  • gtest_grouping_aggregated_transform_bucket_pushed_once.cpp: new test file (unchanged)
  • .gitmodules and all submodule pointers aligned to the 26.6 backport branch — zero true 3-way merge conflicts remain

GitHub's mergeable_state may still show dirty while it recomputes the merge check.

nickitat and others added 8 commits August 31, 2026 15:28
`GroupingAggregatedTransform` pushes a delayed bucket as soon as no input
reports it as delayed any more and every input has read it. Reading it is
not enough: an input whose last chunk is of this bucket can send more
chunks of the same bucket, the producer converts the aggregation variants
of a bucket one by one. Those chunks arrive after the bucket is pushed,
they are put into `chunks_map` again, and the bucket is merged and pushed
a second time, which returns the keys of the bucket twice.

The in order push next to it never had this: it pushes the buckets before
`current_bucket`, and `current_bucket` only moves on when every input has
read a bucket after it. Require the same here, every input has to be
strictly past the bucket.

`Bucket N is pushed twice` fires in the builds with the assertions, and
the rows are silently duplicated in the release ones. Reproduced by
`04605_pr_plan_based_count_distinct_serialized` in the stress and in the
stateless runs with the distributed plan, where the merging of the plan
based parallel replicas became memory efficient.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
A delayed bucket has to be pushed once even when no input ever reads a
bucket after it, and a delayed bucket below the highest one still has to
be pushed before the inputs finish. The driver of the test is shared by
the cases now.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
Whatever the producers postpone and in whatever order their chunks
arrive, every bucket has to be pushed exactly once and the transform has
to finish. Being stricter about when a delayed bucket can be pushed may
only postpone a push: the in order push and the drain of the finished
inputs still take every bucket.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
An input which has finished cannot send more chunks of a bucket, so it
does not have to be past the bucket for the bucket to be pushed. Taking
it into account kept a bucket until the end of the query when a source
ended right on it, although every input which can still send something
had moved past it. An input port reports itself finished only when it has
no data left on it, so nothing of the bucket is lost.

Reported by review of #115264.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
`GroupingAggregatedTransform::prepare` takes the ports whose edge has
changed, `ExecutingGraph::updateNode` collects them from the changed
edges alone. The driver of the test reported every input on every call,
so the transform saw a waiting port without data and dropped it from the
waiting set, although the real executor stays in `NeedData` until that
port really changes. The reproduction relied on that: it pushed the
bucket in a state which does not happen in a pipeline.

Report only the ports which were really given a chunk or finished. The
reproduction is a producer which postponed buckets 6 and 7 and resolves
them in order now, and never sends anything above 7, so `current_bucket`
stays behind the bucket which is pushed.

Reported by review of #115264.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
…ypick/26.6/115487

# Conflicts:
#	src/Processors/Transforms/MergingAggregatedMemoryEfficientTransform.h
`Aggregator::Params` on the 26.6 branch does not take
`enable_packed_string_keys_` yet, drop the argument from the merge
parameters of the test.
@nickitat
nickitat force-pushed the cherrypick/26.6/115487 branch from c89dacc to 8a73f2c Compare August 31, 2026 17:20
@nickitat
nickitat merged commit 0aeb67a into backport/26.6/115487 Aug 31, 2026
1 check passed
@nickitat
nickitat deleted the cherrypick/26.6/115487 branch August 31, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants