Skip to content

Cherry pick #125463 to 26.9: Revert "Push filters below WindowStep on PARTITION BY columns" - #125586

Merged
nihalzp merged 4 commits into
backport/26.9/125463from
cherrypick/26.9/125463
Oct 14, 2026
Merged

nihalzp merged 4 commits into
backport/26.9/125463from
cherrypick/26.9/125463

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

Original pull-request #125463

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.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

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

groeneai and others added 3 commits October 12, 2026 16:54
This reverts commit 338b873 (#110114),
reversing changes made to 662a0a0.

A filter pushed below the window can reach the probe side of a hash join,
which is read only after the build side, so an always-false filter such as
IN over an empty subquery no longer stops the query before the build (#123875).

Conflict resolution: #122975 later changed the reverted branch; the whole
branch is removed, its other call sites and its test stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both queries of #123875 must stop before the LEFT JOIN below the window
reads its right side, which throws if it is read. They fail on master
(the filter is pushed below the window to the join's left input) and
pass with the revert.

The early stop holds only for a hash join that builds the right table,
without parallel replicas and with query_plan_merge_filters = 1, so the
test pins those. Measured on the revert binary: parallel_hash,
grace_hash, full_sorting_merge, parallel replicas and
query_plan_merge_filters = 0 all read the right side, as before #110114.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on-filter-pushdown

Revert "Push filters below WindowStep on PARTITION BY columns"
@robot-clickhouse robot-clickhouse 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 labels Oct 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

I pushed a resolution of this cherry-pick to my fork, branch resolve-26.9-cherrypick-125463 (2ca98dc53fc1). Its parents are 002a17cf2c09 (this PR's head) and c7a27cc51667 (backport/26.9/125463), so applying it is a fast-forward.

The conflicts come from #122975 and #121390, which are not on 26.9: there the removed window branch calls tryAddNewFilterStep without the allow_index_hints argument, and the 26.9 copy of 04365_filter_push_down_window_partition_by still sets query_plan_optimize_prewhere = 0. The resolution deletes the window branch as it exists on 26.9, together with the WindowStep.h include, deletes 04365, and adds 05393_window_over_join_empty_in_set unchanged. Against backport/26.9/125463 it touches the same 5 files as #125463 (+64 -130). Nothing of #122975 is ported.

I tested a Debug build of the resolved tree with clang-22, running the 26.9 clickhouse-test:

  • 05393 passes 50/50. It fails on the official 26.9.18.12, built from b05517531eb8 (the first parent of backport/26.9/125463), because the join reads its right side.
  • 241 window and QUALIFY stateless tests give the same results with and without the resolution, apart from 05393, both with randomized and with fixed settings.

@nihalzp, I have triage but not push on this repository, so I cannot update cherrypick/26.9/125463 myself. Applying it takes two commands:

git fetch https://github.com/groeneai/ClickHouse resolve-26.9-cherrypick-125463
git push origin FETCH_HEAD:cherrypick/26.9/125463

After that the robot merges this PR and opens the 26.9 backport PR itself.

@nihalzp
nihalzp merged commit 4c19926 into backport/26.9/125463 Oct 14, 2026
1 check passed
@nihalzp
nihalzp deleted the cherrypick/26.9/125463 branch October 14, 2026 14:38
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-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.

3 participants