Repository navigation
Conversation
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260701-113900 |
|
cc @KochetovNicolai @vdimir — could you review this? Under the new analyzer, |
|
Workflow [PR], commit [c05bd84] Summary: ✅
AI ReviewSummaryRestores partition and primary-key pruning for grouping-key predicates on aggregating queries over Final VerdictStatus: ✅ Approve |
Is this an optimization the new analyzer should have? Not saying this fix is incorrect or not straightforwardly good, but I wonder if there are even user-provided queries with |
|
Good question. The general optimization already exists for local queries, just at the plan level instead of as an AST HAVING->WHERE rewrite: The regression is specific to the distributed AST round-trip. On your HAVING hypothesis: a plain |
3f18a78 to
9f7a607
Compare
|
Fixed the CI failures on the previous push (Fast test + Style check): Root cause of the Fast-test regressions. The first version ran the HAVING->WHERE move in the shared Fix. Gated the move on the shard subquery actually having a Style check. Verified locally on a 2-shard setup (debug build, matching CI): all four tests pass (03302/03620/03733/04402, 3 runs each); old vs new analyzer results identical across eq/IN/range/aggregate-column predicates; shard-side |
28300bb to
73cc64d
Compare
|
Pushed 73cc64d: fixed the remaining Style check failure. |
73cc64d to
eb19d34
Compare
|
Addressed the automated review blocker in eb19d34 (gate the shard-side HAVING->WHERE move on Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-10:20260701-155100 |
eb19d34 to
4ee964a
Compare
|
Follow-up push Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-4:20260701-174200 |
4ee964a to
193fb97
Compare
|
The Rewrote Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-0:20260701-205800 |
193fb97 to
2604acf
Compare
|
Follow-up push Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-7:20260701-221700 |
2604acf to
f03fe3a
Compare
|
Test-only follow-up on Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260701-234100 |
CI finish ledger — f03fe3aCI fully finished. Every blocking check is green: all Stateless (incl.
No PR-caused failure. The source fix (predicate move to shard Session id: cron:our-pr-ci-monitor:20260702-040000 |
|
Fixing PR for the Bugfix-validation server-boot exit-115 infra failure on the CI finish ledger: #109115 (retry the transient initial clickhouse-server boot in functional-test setup). The failure on this PR (sha f03fe3a, |
f03fe3a to
527b0d0
Compare
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260702-112700 |
|
🕵 Merged the latest
@groeneai, investigate the |
|
Acknowledged. I'm investigating the |
|
The Fix: #128016. A failed write is now kept and rethrown to the later appends, so the query reports the error that broke the stream. I can't read the private log, so the original error of that run is not confirmed. If a failed write broke the stream there too, its next occurrence will report that error instead of 734. Public CI ran this test 3730 times since #123531 (1749 of them with s3 or azure storage), with no failure. |
CI finish ledger - cc7ccc8Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
No job was dropped. Both Session id: cron:our-pr-ci-monitor:20261028-033006 |
|
🕵 Merged the latest @novikd, the change no longer touches |
CI finish ledger - 1376595Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Both Session id: cron:our-pr-ci-monitor:20261028-230003 |
…NG` rewrite The traversal of `moveNonAggregateHavingConjunctsToWhere` visited the arguments listed in `TableFunctionNode::getUnresolvedArgumentIndexes`, like the query of `view` or the arguments of a parameterized view. They are deliberately left unresolved, so `getResultType` threw `Function node with name 'plus' is not resolved` for queries over `Distributed` with such a subquery in `HAVING`. Skip these arguments, as `InDepthQueryTreeVisitorWithContext` does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=109052&sha=latest&name_0=PR&name_1=Fast%20test%20(arm_darwin) ( |
|
The fix is #128088 (mine), merged at 16:27 UTC. The test holds the The run you linked is on 1376595 (2026-10-28), built before the fix. The CI now running on 4d828e0 checked out merge commit 0d88a14 on top of cbccce8 (the #128088 merge), so its |
… on shards
`CAST([k] AS Array(Date))`, `CAST(tuple(k) AS Tuple(Date))` and
`CAST(map('a', k) AS Map(String, Date))` convert each nested number as a Unix
timestamp in the time zone of the executing server, but `dependsOnServerTimeZone`
checked only a scalar `Date`/`Date32` result with a numeric first argument, so
such conjuncts were moved to `WHERE` on the shards. Now the `CAST` family is
server-dependent when its result contains a `Date`/`Date32` and its argument
contains a number at any depth. `hasImplicitTimeZone` reuses the new
`containsType` helper.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ring in `HAVING` on shards The `String` overloads of `toWeek`, `toYearWeek` and `toDayOfWeek` parse the string in `CustomWeekTransformImpl` as a point in time in the time zone of the executing server, unless the third (time zone) argument is given. There is no `DateTime` node for `hasImplicitTimeZone` to catch, so a shard with a different time zone could move such a conjunct to `WHERE` and drop its contribution. Treat these calls as server-dependent when the time zone argument is omitted or empty. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a string An empty time zone argument is rejected by `toWeek`, `toYearWeek` and `toDayOfWeek` with `ILLEGAL_TYPE_OF_ARGUMENT`, so only the omitted one selects the time zone of the server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Planner/Planner.cpp
|
🕵 Merged the latest |
# Conflicts: # src/Planner/Planner.cpp
|
🕵 Merged the latest |
CI finish ledger - 0deab63Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261108-193008 |
|
🕵 Merged the latest |
|
🕵 Merged the latest |
|
🕵 Merged the latest The red on de54b7e was not a test failure: 32 jobs of that run were cancelled before any step ran ( No review threads are unresolved. The blocking |
When a query over a
Distributedtable is processed on a shard only up toWithMergeableState, the shard does not executeHAVING: the initiator applies it after merging the aggregation states. Under the analyzer, a predicate on aGROUP BYkey that reached the shard asHAVINGwas therefore never used on the shard for partition pruning or primary key analysis, and every shard read and aggregated all of its local data. This happens for a filter over an aggregating view or subquery over aDistributedtable, because the pushed-down filter is added to the shard query asHAVING, and also for a plainHAVINGon a grouping key. The old analyzer avoided it withPredicateExpressionsOptimizer, which moved such conjuncts toWHERE.The fix is in
Planner: for a query processed up toWithMergeableState, theHAVINGconjuncts that do not depend on the aggregation result are moved toWHERE, on the resolved query tree. The classification is shared with the existinganalyzer_compatibility_allow_non_aggregate_in_havingrewrite inQueryAnalyzer(newmoveNonAggregateHavingConjunctsToWhere). Conjuncts with aggregate functions,grouping,arrayJoinor non-deterministic functions stay inHAVING. Window or stateful functions disable the rewrite.WITH CUBE/ROLLUP/TOTALS/GROUPING SETSare skipped. Results are unchanged; only pruning on shards changes.The
serialize_query_plan = 1path is not covered.Closes: #108284
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a performance regression of the analyzer: a filter on a
GROUP BYkey of an aggregating query over aDistributedtable (for example, a filter over an aggregating view, orHAVINGon a grouping key) is applied on shards before aggregation, so shards can prune partitions and use the primary key. Previously each shard read all of its data, which could lead toMEMORY_LIMIT_EXCEEDED.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/109052]