Repository navigation
Fix flaky 03223_nested_json_in_shared_data_merges: order its SELECTs - #128385
alexey-milovidov merged 1 commit into
Conversation
The six `select JSON*Paths(arrayJoin(json.a[])) from test` queries had no ORDER BY, so they asserted the physical read order of the merged part. With a randomized `index_granularity = 1` the merged part (10, then 15 rows) has one granule per row. On a remote disk the minimum read task is `merge_tree_min_read_task_size` = 8 marks (the `_for_remote_filesystem` row/byte minimums default to 0), so the part is read as two tasks, [0, 8) and [8, N), whose streams are united without order; the short task usually finishes first and its rows are printed first. That is the failure seen in `Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)` on PR ClickHouse#116577 (172 of 174 same-settings reruns failed). Only release builds can draw that granularity: debug and sanitizer builds draw it from [100, 65536]. Order each SELECT by its own result (`order by all`) and reorder the reference within each section accordingly. The per-section contents are unchanged, and since every row carries exactly one path, those multisets still pin which path is dynamic and which is in shared data. `order by _part_offset` is not usable here: the planner evaluates the JSON*Paths functions after that sort, on a JSON column re-assembled from the two read tasks' chunks, which changes the reported layout (the `c` paths become dynamic). With `order by all` the sort key is the function result, so the function still runs on each read chunk before the sort. Related: ClickHouse#116577 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; 0 findings) plus my own cold review of the diff (0 findings on the test change). I checked that Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261031-153600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261031-150800 |
|
Workflow [PR], commit [1950b83] Summary: ✅ AI ReviewSummaryThe PR stabilizes Final VerdictStatus: ✅ Approve |
|
cc @Avogar, could you review this and add the |
6d1f61b
Related: #116577
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The test failed in
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)on #116577, and 172 of 174 reruns with the same settings failed too.None of the six
select JSON*Paths(arrayJoin(json.a[])) from testqueries has anORDER BY. A randomizedindex_granularity = 1gives the merged part one granule per row. On a remote disk the minimum read task is 8 marks, so the part is read as two tasks whose streams are united in no particular order.The queries now end with
order by all, and the reference is reordered within each section without changing its contents. I did not useorder by _part_offset: the planner evaluatesJSON*Pathsafter that sort, on a re-assembled JSON column, which changes the reported layout.Validation: replaying the CI job's exact settings with parallel replicas against an s3-backed server, 78/100 (
parallel_replicas_local_plan = 1) and 45/50 (= 0) runs fail before the fix, and 100/100 pass after it with each value.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/128385]
Version info
26.11.1.1048-master(included in26.11and later)