Repository navigation
Re-measure the query_28 expected value in 03634_autopr_output_bytes_estimation - #111981
Conversation
…s_estimation` The test compares the `RuntimeDataflowStatisticsOutputBytes` profile event against a recorded value per query and fails when the two differ by more than 2.5x. For `query_28` the recorded value had gone stale: the estimate is a stable ~58 MB while the array still said `23722663`, a ratio of ~2.45. That left the check no margin at all, so the test failed as soon as a run landed slightly above the average - the reported failure is `query_28 59335657 23722663`, a ratio of 2.5012. The estimate is not noisy. In the failing job the query ran nine times (the failure plus the eight reruns of the randomized-settings diagnosis, across two independent randomizations) and produced 57843408..59335657 bytes, a spread of 1.3%. The other ten queries in the test match their recorded values within 1.00..1.41x, so only this one entry is off. `query_28` is the only query whose output is dominated by variable-size aggregate states - `MIN(Referer)` over a two-level hash table with many groups - which is why it drifted on its own. Use the median of the nine observations, `58136394`, which puts every observed run within 1.02x of the recorded value. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=5baed0f5a10c333cd220b9646d6ef4647425079d&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [8f992a4] Summary: ✅ AI ReviewSummaryThis PR re-records the Final Verdict
|
|
Follow-up: I found the reason
Fixed in #111985. The estimate there is expected to drop back to roughly the 23722663 this array already records. These two PRs touch the same line and are mutually exclusive. This one is the interim unblock for the master CI failure; if #111985 lands first, close this one as unnecessary, and if this one lands first, #111985 has to set |
…ery28-calibration
… early-conversion one The review objected that `58136394` is the value that the `group_by_two_level_threshold*` pins in this test were added to exclude, so making it the golden would stop the test from catching a regression back onto the early-two-level-conversion path. The server log of the failing job refutes that for current master. All nine `query_28` runs in that job execute the same pinned `SET`s, and the first of them - with a cold hash-table size-hint cache - started with the single-level `key_string` method, logged `Converting aggregation data to two-level` when it crossed the pinned default `group_by_two_level_threshold` of 100000, and still reported `RuntimeDataflowStatisticsOutputBytes` of 58092765: | run | first `Aggregation method` | output bytes | | --- | --- | --- | | 07:23:46 | `key_string` (then converted) | 58092765 | | 07:52:40 | `key_string_two_level` | 59335657 | | 08:37:33 | `key_string_two_level` | 57843408 | | 08:37:43 | `key_string_two_level` | 58136394 | | 08:37:52 | `key_string_two_level` | 58222877 | | 08:38:01 | `key_string_two_level` | 58671197 | | 08:38:10 | `key_string_two_level` | 58398433 | | 08:38:19 | `key_string_two_level` | 58074861 | | 08:38:28 | `key_string_two_level` | 57992381 | The later runs are initialized as two-level straight away because `initDataVariantsWithSizeHint` finds a cached size hint above the threshold, not because of the thresholds themselves - so the pin is still doing its job, and the pinned-default path itself now lands at ~58 MB. Record that reasoning next to the array. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Correction to my earlier follow-up above: the What I did verify (details in #111981 (comment)): the ~58 MB is the value the pinned-default path produces - the first of the nine runs started single-level and converted only at the pinned default threshold, and still reported |
…ery28-calibration
…ery28-calibration
The previous justification cited a `query_28` run that came from the sibling `03634_autopr_input_bytes_estimation.sql` (identifiable by its unpinned `group_by_two_level_threshold=883857` / `max_block_size=94183`), so it said nothing about the pinned-default path of this test. The reviewer is right about that. What the ~58 MB actually is: `Aggregator::estimateSizeOfCompressedState` serializes the sampled states into the `NullWriteBuffer` instead of into the `CompressedWriteBuffer` wrapped around it, so the reported figure is the uncompressed serialized size of the states, not their size on the wire. That is the reason the estimate overshoots the transferred bytes by ~2.45x here. Recorded in the test comment, including the note that the value has to be re-measured (back to about `23722663`) once the estimator is fixed.
…mment Measured with pre-built CI binaries against the `hits_v1` dataset under the test's pinned settings: master produced ~57..58 MB for `query_28` continuously since at least 2026-04-01 (2026-04-01: 57.3 MB, 2026-06-10: 57.8 MB, 2026-07-26 just before the merge of #110573: 57.0 MB, current master: 58.2 MB), so nothing regressed in the aggregation or statistics path around the failure. The recorded 23722663 was calibrated on 2025-12-31 on the branch of #93271 and carried unchanged into #110573, whose merge also overwrote the value master had been green with since February, 31064320 (ratio ~1.85 against the actual ~58 MB, which is why master stayed green until the merge). The final head of #93271 (before the `HashMethodPackedString` simplification) measures 58.4 MB as well, so the pull request itself does not change the estimate. With `group_by_two_level_threshold=1` the current estimate is 58170420 vs 58237072 at the pinned defaults, i.e. the threshold no longer affects this value. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=5baed0f5a10c333cd220b9646d6ef4647425079d&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 Co-Authored-By: Claude Fable 5 <[email protected]>
…e compressed estimate #111981 re-measured `query_28` to 58136394, the uncompressed serialized size the estimator reported while it serialized the sampled states into the `NullWriteBuffer`; that change and this fix touch the same value and were explicitly mutually exclusive. With the estimator measuring the compressed size, the estimate returns to the compressed figure the test had been calibrated against before: both CI runs of this pull request (4cef641 and 6d554ce, before #111981 merged) passed this test with 23722663. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111985&sha=6d554cecfe7ebd6ab6819102f316beb2ebf0436e&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 Co-Authored-By: Claude Fable 5 <[email protected]>
03634_autopr_output_bytes_estimationcompares theRuntimeDataflowStatisticsOutputBytesprofile event against a recorded value per query and reports every query whose estimate differs from the recorded one by more than 2.5x. Forquery_28the recorded value is stale: the estimate is a stable ~58 MB while the array said23722663, a ratio of ~2.45. That left the check no margin at all below the 2.5 bound, so the test failed as soon as a run landed slightly above the average. The reported failure isquery_28 59335657 23722663, a ratio of 2.5012.The estimate is not noisy. In the failing job the query ran nine times - the failure plus the eight reruns of the randomized-settings diagnosis, spanning two independent randomizations - and produced 57843408..59335657 bytes, a spread of 1.3%. Reading the estimates back out of the server log for every query in the failing run shows the other ten match their recorded values within 1.00..1.41x, so this single entry is the only one that is off:
query_1query_10query_12query_15query_20query_21query_22query_23query_28query_34query_43Where the stale value came from - measured, not conjectured
The review rightly insisted that re-recording a golden without knowing why it moved risks hiding a regression. It has now been measured, by running
query_28with this test's exact pinned settings against thehits_v1dataset using pre-built CI binaries of historical commits:query_28estimatea3312f32194c720f10f0dae1648b6cff3(just before the merge of #110573)cd73b80e0c9(before theHashMethodPackedStringsimplification)So master has produced ~57..58 MB for this query continuously since at least 2026-04-01, and #110573 itself does not change the estimate. Nothing regressed in the aggregation or statistics path - there is no later change to find, because the estimate never moved in the first place.
What actually happened: the
23722663golden was calibrated on 2025-12-31 (commitFix testson the branch of #93271, the original of #110573) and was carried unchanged for seven months. Meanwhile master had recalibrated this test on its own - since at least 2026-02-15 master's array said31064320forquery_28, which kept the check green against the actual ~58 MB (ratio 1.85). When #110573 merged on 2026-07-26 it replaced the whole array with the December values, overwriting master's fresher calibration, and the test went red within an hour on the first master run. The other ten December entries happen to still be within the 2.5x tolerance;query_28sits at 2.45..2.50x.A side finding: with
group_by_two_level_threshold=1the current estimate is 58170420 vs 58237072 at the pinned defaults - the two-level threshold no longer affects this value at all, so the pin added in8746386893(based on the December expectation) guards nothing forquery_28today, though it remains harmless and still reduces randomization noise.Why ~58 MB, and the relation to #111985
The ~2.45x gap between the estimate and the recorded value is the estimator defect described below:
Aggregator::estimateSizeOfCompressedStateserializes the sampled states into theNullWriteBufferinstead of into theCompressedWriteBufferwrapped around it, so it reports the uncompressed serialized size of the states rather than their size on the wire, and forquery_28- the only query here whose output is dominated by variable-size aggregate states (MIN(Referer)over a two-level hash table with many groups) - that overshoots the transferred bytes by ~2.45x.This pull request is therefore the fallback, not the preferred fix. #111985 fixes the estimator itself, and with that fix this test passes with the golden left at
23722663. The two changes are mutually exclusive: if #111985 lands, this one should be closed; only if it does not should the golden be re-based as done here.This change records the median of the nine observations,
58136394, which puts every observed run within 1.02x and restores the intended margin.Details of the defect:
Aggregator::estimateSizeOfCompressedStatebuilds aCompressedWriteBuffer wbuf(wb)but serializes the sampled states into the underlyingNullWriteBuffer wbinstead of intowbuf, then readswb.count().wbufis never written to, so the function returns the uncompressed serialized size despite its name and itsWe only interested in the size of compressed statecomment. That has been the behaviour since the function was introduced, so every recorded value in this test already accounts for it, and correcting it would need all of them re-measured. It is left alone here and fixed in #111985 instead.Related: #111985
Related: #110573
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=5baed0f5a10c333cd220b9646d6ef4647425079d&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29
Changelog category (leave one):
Version info
26.8.1.553(included in26.8and later)