Repository navigation
Fix flaky test 04502_autopr_input_bytes_estimation_window_function under randomized sparse serialization - #125877
Conversation
…function The `output_measured_above_read` check failed on the `Output <= 2 * Input` bound. The test harness randomizes the MergeTree setting `ratio_of_defaults_for_sparse_serialization`, and 30% of draws are 0. `key` and `value` each hold one default, so with 0 both columns are stored Sparse. The runtime output estimate then sums `byteSize()` of the `ColumnSparse` chunk (values plus offsets, ~16 bytes per row per column) but divides it by a compression ratio measured on the Native-serialized Sparse sample (~9 bytes per row per column), so the same rows are priced ~1.7x higher than dense ones (33 vs 17 bytes per row for the bare-scan output). Which chunks the 1-in-5 sampler hits varies, so Output/Input ranged 1.28-2.21 in the failing job (rerun 19/46 failed) and either arm could cross 2x, while dense columns stay at 0.21-1.24. Pin `ratio_of_defaults_for_sparse_serialization = 1.0` on the test's only table. An explicit table setting is never overridden by the randomized one (`ClientBase::addMergeTreeSettings` adds only absent settings), also under an explicit `--merge-tree-settings` replay. Locally, with the failing job's own settings blobs and server codec ZSTD(3): unfixed 4/200 and 2/200 failures (ratio up to 2.14), fixed 200/200 on two builds (max 1.13), 50/50 randomized under LZ4, ZSTD(1) and ZSTD(3), and 100/100 with `--replicated-database`. 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 a separate cold review of the diff (0 findings). No findings to adjudicate. Session id: cron:clickhouse-review-slot-9:20261014-205200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261014-202100 |
|
Workflow [PR], commit [817f5b1] Summary: ✅ AI ReviewSummaryPR #125877 stabilizes Missing context / blind spots
Final Verdict✅ Approve. No changes requested. |
|
cc @nickitat, could you review this and add |
a21868c
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Requested in #125131 (comment). Failing run: Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 2/2), where
04502_autopr_window_function_query_plan_basedprinted0and the rerun with the same settings failed 19/46.The failing check is the
Output <= 2 * Inputbound, not a zero. The harness randomizesratio_of_defaults_for_sparse_serialization, and that job drew0.keyandvalueeach hold one default, so both were storedSparse. The output estimate sumsbyteSize()of theColumnSparsechunk (values plus offsets) but divides by a compression ratio measured on the Native-serialized Sparse sample, so the same rows are priced about 1.7x higher than dense ones (OutputChunk bytes=33.0Mvs17.0Mfor 1M rows). Which chunks get sampled varies run to run, so Output/Input ranged 1.28-2.21 in that job and both arms crossed 2x. Dense columns stay at 0.21-1.24 in every configuration I tried.The change pins
ratio_of_defaults_for_sparse_serialization = 1.0on the test's only table, the same pin as the autopr statistics tests in #122570. The explicit table setting wins over the randomized one..referenceis unchanged.Validation, local, with that job's own settings blobs and server codec
ZSTD(3): unfixed 4/200 and 2/200 failures (Output/Input up to 2.14); fixed 200/200 on two builds (max 1.13), 50/50 randomized under each server codec LZ4 / ZSTD(1) / ZSTD(3), and 100/100 with--replicated-database.The Sparse inflation of the output estimate itself is not changed here: I measured no user-visible consequence of it.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125877]
Version info
26.11.1.38-master(included in26.11and later)