Repository navigation
Conversation
Since ClickHouse#126219 the GROUPING SETS check in tryPushDownFilter also counts the columns that an implied indexHint reads, so that a filter consisting only of such a hint cannot prune rows below a set that lacks its key. But the hint's own actions are built from the query tree and read the table column (`k` of key `intDiv(k, 10)`, `ts` of `toDate(ts)`), which is in no grouping set. The check then rejected the whole filter, and its other conjuncts (`v < 3`), which 26.10 pushed to the read, stopped pruning: the query from ClickHouse#128072 read 78/78 granules instead of 3/78. Collect the hint inputs separately. The filter's own identifiers still gate it as before. When a hint input is missing from some set, push the filter with PushDownIndexHints::None, so the other conjuncts go below the aggregation as on 26.10 and every hint stays above it; otherwise keep PushDownIndexHints::Implied as on master. Applies to MergingAggregated too. The existing GROUPING SETS ((a, b), (b)) case of 05401 still returns 0; with the hints pushed (Implied instead of None) it returns 1. Closes ClickHouse#128072 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own review (2 nits).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261028-162700 |
|
cc @nickitat @novikd, could you review this and add the |
|
Workflow [PR], commit [b69d8bb] Summary: ✅
AI ReviewSummaryReviewed PR head Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units7 translation units recompiled, 14 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - ec46cd5Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The flaky check passed the extended test Session id: cron:our-pr-ci-monitor:20261029-013003 |
…ets-hint-gate-128072 Resolve the conflict in filterPushDown.cpp: master rewrote findIdentifiersOfNode on top of visitReachableNodes; keep that form and route the implied indexHint inputs to the separate set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The plain conjunct `v < 3` prunes to `3/79` on its own, so without a derived hint the granule check passes whether or not the fix is present (measured with `optimize_and_compare_chain = 0`). Assert the hint is there first, as the other cases of this test already do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #128077 to 26.10: Do not let a derived `indexHint` keep `HAVING` above `GROUPING SETS`
…ING` above `GROUPING SETS`
Backport #128077 to 26.10: Do not let a derived `indexHint` keep `HAVING` above `GROUPING SETS`
Closes: #128072
Related: #126219
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Since #126219 (master, and the 26.10 branch through its backport #128130; in no release yet), a
HAVINGoverGROUPING SETSwhose compare chain or OR-LIKE chain derives anindexHinton a key expression is no longer pushed below the aggregation, so its other conjuncts stop pruning. With the table from #128072 (ORDER BY v), this reads 78/78 granules instead of 3/78 on 26.10.2; results are the same:#126219 made the
GROUPING SETScheck intryPushDownFilteralso count the columns a derived hint reads. The hint's own actions read the table columnk, not the keyintDiv(k, 10), sokis in no grouping set and the check rejected the whole filter.Now the check still rejects a filter whose own columns are missing from a set. When only a derived hint reads such a column, the filter is pushed with
PushDownIndexHints::None: the other conjuncts go below the aggregation as on 26.10.2 and the hints stay above it, so a hint never prunes rows that a set without its column aggregates. This coversMergingAggregatedtoo.Validation:
05401_index_hint_derived_below_group_bygains the issue's query and aremote('127.0.0.{1,1}')variant (79/79 granules without the fix, 3/79 with it). Its existingGROUPING SETS ((a, b), (b))case still returns 0, and returns 1 if the hints are pushed. 50/50 randomized, 10/10 with a Replicated database; the grouping sets, filter push-down and index hint tests pass.Workflow [PR]
Sync PR [sync-upstream/pr/128077]
Version info
26.11.1.2202-master(included in26.11and later)26.10.7.24