Repository navigation
Fix wrong window function result when indexHint is pushed below the window - #122975
Conversation
|
Workflow [PR], commit [d96fa0b] Summary: ✅
AI ReviewSummaryThis PR blocks Tests
Final Verdict
LLVM Coverage ReportMeasured on commit d96fa0b.
Changed lines: Changed C/C++ lines covered: 51/51 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units1231 translation units recompiled, 8601 s compile time in total, 1231 of them have a recent master baseline. |
|
@yariks5s @nihalzp — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
This reverts commit 338b873 (ClickHouse#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 (ClickHouse#123875). Conflict resolution: ClickHouse#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]>
Since ClickHouse#122975 a filter pushed below AggregatingStep / MergingAggregatedStep / LimitByStep refuses every indexHint, because a user-written hint is row-level TRUE and pruning by it below a key step can drop part of a group. That also refuses the hints optimize_and_compare_chain derives (`a < b AND b < 10` adds `indexHint(a < 10)`), and since a hint blocks its ancestors, an OR holding one, so such HAVING / outer WHERE filters read the whole table. A derived hint is implied by the other conjuncts of its `and`, so the granules it prunes contain only rows of groups the filter rejects anyway. Mark such hints in FunctionIndexHint, carry the mark through the planner and buildFilterActionsDAG, and admit only marked hints at key steps. The planner deduplicates equal hints by name, so a user hint equal to a derived one clears the mark of the shared node. Closes ClickHouse#124502 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix wrong window function results when a
QUALIFYcondition, or a comparison derived from it byoptimize_and_compare_chain, turned into anindexHintthat pruned rows below the window, Closes #121177Workflow [PR]
Sync PR [sync-upstream/pr/122975]
Version info
26.10.1.1763-master(included in26.10and later)