Repository navigation
Pin the full EXPLAIN output in 04878_distributed_plan_shuffle_bucket_order_promise - #120757
Conversation
…order_promise Requested in review on the merged PR ClickHouse#116446: ClickHouse#116446 (comment) The test asserted its plan claims with 12 rows of the form `SELECT count() ... FROM (EXPLAIN ...) WHERE explain ILIKE '%...%'`. Each row projects the plan onto one bit and discards it before the comparison, so a red row prints `1 -> 0` and nothing about the plan, and reading the failure means rebuilding and re-running the explain by hand. The same test is red on the 26.6 backport ClickHouse#120640 right now, with exactly that output. Those 12 rows use only 7 distinct explain queries, differing solely in their `SETTINGS` clause, so they collapse onto 7 pinned plans, each behind a `SELECT '-- label';` marker line so the reference stays navigable. Every `SET` pin and every behavioural row is unchanged: the three `FORMAT Null` rows that must not hit the duplicate-bucket rejection, and the two `HAVING k = 7` result-equality rows. Each block keeps the smallest flag set its claims need. Five are a plain `EXPLAIN`, since the step descriptions they read (`by hash(...)`, `partial`, `merge`) are printed without `actions = 1`. The two asserting the merge mode do need it, because `Mode: memory-efficient` is printed only by `MergingAggregatedStep::describeActions`; those two add `compact = 1`, which makes `skip_expressions` walk past every `Expression` step in the initiator plan and, through `ExplainPlanOptions::toSettingsChanges`, in both shard plans, so their `Actions:`/`Positions:` dumps stay out of the reference. `pretty = 1` is not usable here, as it cannot represent per-shard plans. `index_granularity_bytes = 0` and `min_bytes_for_wide_part = 0` are new in the DDL. The two `actions = 1` plans print `ReadFromMergeTree`'s granule count, and the runner randomizes both of that number's inputs. `index_granularity_bytes` is drawn from `[1024, 30 MiB]` (`tests/clickhouse-test:2006`), and once it falls below `index_granularity` times the row size the adaptive byte quotient replaces the fixed 256 rows per granule: measured on this 16-byte fixture, 2048 prints `Granules: 1563` and 1024 prints 3125, against 782 at 4096 and above. The 100 KiB floor that hides the window applies only to sanitizer, debug and coverage builds (`:2096-2103`), so a release-flavour run is the exposed one. `min_bytes_for_wide_part` moves the same number by one between the two part formats. With adaptive sizing off the count is `ceil(rows / index_granularity)` for any block width and either format, which also closes the row-width exposure through the randomized `enable_block_number_column` and `enable_block_offset_column`. A table setting in the DDL holds against the runner's injection, which skips settings the query already sets, and against the server default alike, which is why the `index_granularity = 256` this reference also depends on already survives there. Validation: removing the guard hunk ClickHouse#116446 added at `makeDistributed.cpp:715-721` makes 4 of the 7 blocks red, with `ShuffleExchange (by hash([__table1.k]))` reappearing once per shard plan, while the 3 blocks asserting that the shuffle stays when nothing promises bucket order are byte-identical; the reference reds on that regression and only there. The granule pins are proven through the runner's own merge-tree injection seam: `--merge-tree-settings "--index_granularity_bytes 2048"` passes with them and reds `Granules: 782 -> 1563` on all four lines without them. 50 of 50 runs green with settings randomization on (161-196 settings drawn per query, 50 distinct randomized merge-tree tails, part format Wide in all 50). The reference is generated from the runner's own stdout, not pasted by hand. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex). 7 findings adjudicated over two
Severity: ❌ blocker / Two things that are not defects but are worth knowing. The pinned shape is more brittle than the Session id: cron:clickhouse-review-slot-8:20260918-075300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260918-072500 |
|
Workflow [PR], commit [26ccaef] Summary: ✅ AI ReviewSummaryThis PR rewrites Missing context / blind spots
Final Verdict✅ No actionable review findings. No inline comments were posted. |
0c11578
Related: #116446
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Requested in review on #116446: #116446 (comment)
That test asserted its plan claims with 12 rows of the form
SELECT count() ... FROM (EXPLAIN ...) WHERE explain ILIKE '%...%'. Each row projects the plan onto one bit and discards it before the comparison, so a red row prints1 -> 0and nothing about the plan, and reading the failure means rebuilding locally and re-running the explain by hand.The 12 rows use only 7 distinct explain queries, differing solely in their
SETTINGSclause, so they become 7 pinned plans, each behind aSELECT '-- label';marker line so the reference stays navigable. EverySETpin and every behavioural row is unchanged: the threeFORMAT Nullrows that must not hit the duplicate-bucket rejection, and the twoHAVING k = 7result-equality rows.Each block keeps the smallest flag set its claims need: five are a plain
EXPLAIN, and the two asserting the merge mode addactions = 1, compact = 1, becauseMode: memory-efficientis printed only byMergingAggregatedStep::describeActions, andcompact = 1drops theExpressionsteps' action dumps.Two new DDL pins on the fixture,
index_granularity_bytes = 0andmin_bytes_for_wide_part = 0: those twoactions = 1plans printReadFromMergeTree's granule count, and the runner randomizes its inputs. With adaptive sizing off the count isceil(rows / index_granularity)for any block width or part format.Validation: removing the guard #116446 added makes four of the seven blocks red, with
ShuffleExchange (by hash([__table1.k]))reappearing in both shard plans, while the three blocks asserting that the shuffle stays are byte-identical. The granule pins are proven deterministically through the runner's own injection seam,--merge-tree-settings "--index_granularity_bytes 2048": green with the pins,Granules: 782 -> 1563on all four lines without them. 50 of 50 randomized runs green.Workflow [PR]
Sync PR [sync-upstream/pr/120757]
Version info
26.10.1.154(included in26.10and later)