Skip to content

Revert "Record the static conditions of a PREWHERE shared with a join runtime filter in the query condition cache" - #131167

Merged
rschu1ze merged 7 commits into
ClickHouse:masterfrom
groeneai:revert-122380-qcc-prewhere-attribution
Nov 24, 2026
Merged

rschu1ze merged 7 commits into
ClickHouse:masterfrom
groeneai:revert-122380-qcc-prewhere-attribution

Conversation

@groeneai

@groeneai groeneai commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Reverts #122380

Related: #122380
Related: #125702
Related: #122044

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Description

As asked on #122380, this reverts it together with its test-only follow-up #125702, which is reverted first so that the second revert has no modify/delete conflict on test 05258. The query condition cache miss of #122044 comes back: when a join runtime filter shares PREWHERE with static WHERE conditions, the cache again records nothing for those conditions.

Conflicts were resolved by keeping the later changes in the same lines: is_query_prewhere (#130645), the last_reader_evaluating_defaults argument (#128452), readsSameColumns (#124880), follows_top_k_filter (#129882), and the PREWHERE query condition cache write of #115522 in its own form before it merged #122380.

Validation (debug build): no symbol of #122380 remains. Master's 05258_query_condition_cache_prewhere_attribution fails on this build and passes on master. 507 related stateless tests give the same results on this build and on master.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/131167]

Version info

  • Merged into: 26.12.1.436-master (included in 26.12 and later)

groeneai and others added 2 commits November 12, 2026 23:48
…qcc-no-parallel"

This reverts commit 61a00a8, reversing
changes made to ce42026.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… runtime filter in the query condition cache"

This reverts commit 64da8a0, reversing
changes made to be89302.

Conflicts resolved by keeping the later changes in the same lines:
`is_query_prewhere` (ClickHouse#130645), the `last_reader_evaluating_defaults`
argument (ClickHouse#128452), `readsSameColumns` (ClickHouse#124880), `follows_top_k_filter`
(ClickHouse#129882), and the PREWHERE query condition cache write of ClickHouse#115522 in
its own form before it merged ClickHouse#122380.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding). Pure-revert check: git merge-tree of the revert of the merge commit 64da8a0 on top of the revert of #125702 matches this tree in every file outside the 4 conflicts, and each conflict drops only lines #122380 added.

# Sev Finding Verdict Evidence / action
1 ⚠️ The restored SYSTEM CLEAR QUERY CONDITION CACHE in parallel test 03229 could evict entries other tests need DISAGREE No parallel test that enables the cache asserts a surviving entry (a clear only turns a hit into a miss); the tests that need one are no-parallel, and the runner starts them after the parallel ones finish. The 104 cache tests x5 at -j 16 on this build: 460 OK, 0 FAIL. The line is 03229's own text before #122380.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-10:20261113-004800

@clickhouse-gh

clickhouse-gh Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [91ad266]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog can be tested Allows running workflows for external contributors comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. labels Nov 13, 2026
@rschu1ze

Copy link
Copy Markdown
Member

@groeneai Resolve the merge conflicts.

…rewhere-attribution

# Conflicts:
#	src/Storages/MergeTree/MergeTreeReadersChain.cpp
#	src/Storages/MergeTree/MergeTreeSplitPrewhereIntoReadSteps.cpp
@groeneai

Copy link
Copy Markdown
Collaborator Author

Resolved in 6af86d4 (merge of master). The conflicts were with #131075 in MergeTreeReadersChain.cpp and MergeTreeSplitPrewhereIntoReadSteps.cpp: I kept all of #131075 and dropped only the lines #122380 added there, so the diff against master is unchanged (same 12 files, +21/-379).

# Conflicts:
#	src/Processors/QueryPlan/Optimizations/optimizePrewhere.cpp
#	src/Storages/SelectQueryInfo.h
@nickitat

Copy link
Copy Markdown
Member

🕵 Merged master into this branch and resolved the conflicts caused by #129617 (the switch to the -WithMemoryTracking containers). This update was made automatically.

@rschu1ze

Copy link
Copy Markdown
Member

@groeneai Merge master into this PR

…rewhere-attribution

Conflict in MergeTreeSplitPrewhereIntoReadSteps.cpp with ClickHouse#131511: keep its
`crosses_dynamic_filter_boundary` split rule, drop only `is_first_unattributed`
added by ClickHouse#122380.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master in a9d35fd. The one conflict was with #131511 in MergeTreeSplitPrewhereIntoReadSteps.cpp: I kept its crosses_dynamic_filter_boundary rule and dropped only the is_first_unattributed term #122380 added, so the diff against master is unchanged (12 files, +21/-379).

…rewhere-attribution

Conflict in MergeTreeSplitPrewhereIntoReadSteps.cpp with ClickHouse#132112: keep its
`may_throw` / `prewhereConditionCannotThrow` split rule, drop only
`is_first_unattributed` added by ClickHouse#122380.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master again in deec7d8 to resolve a new conflict with #132112 in MergeTreeSplitPrewhereIntoReadSteps.cpp: I kept its may_throw rule and dropped only the is_first_unattributed term #122380 added, so the diff against master is unchanged (12 files, +21/-379).

…rewhere-attribution

Conflict in MergeTreeSplitPrewhereIntoReadSteps.cpp with ClickHouse#129445, which
replaced the grouping loop by `appendGroups` / `ConjunctionSplitter` and
carried the ClickHouse#122380 query condition cache attribution boundary into it
(`ConditionGroup::ends_cache_prefix`, the `cache_prefix` parameter,
`attributed_children`). Keep ClickHouse#129445's conjunction and alias splitting,
drop only the attribution parts. Without an attribution, master's code
already ran with `cache_prefix = 0`, which is the reverted behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master again in 91ad266 to resolve a conflict with #129445 in MergeTreeSplitPrewhereIntoReadSteps.cpp. #129445 replaced the grouping loop with appendGroups / ConjunctionSplitter and carried the #122380 attribution boundary into it (ConditionGroup::ends_cache_prefix, the cache_prefix parameter, attributed_children), so I kept its conjunction and alias splitting and removed only those parts. Without an attribution its code already ran with cache_prefix = 0, which is what remains; the diff against master is now 12 files, +25/-389. Master's 05258 still fails on this build and passes on master, and #129445's 05508/05509 pass.

@rschu1ze
rschu1ze added this pull request to the merge queue Nov 24, 2026
Merged via the queue into ClickHouse:master with commit 2a629ab Nov 24, 2026
194 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants