Repository navigation
Keep the set of IN in memory in 00673_subquery_prepared_set_performance - #126681
Conversation
Since ClickHouse#124907 the test runner randomizes max_bytes_before_external_set and max_bytes_ratio_before_external_set. A threshold below the memory of the 1M-key set makes the set spill while it is built, and such a set keeps no explicit elements, so the primary key cannot use it and force_primary_key = 1 throws INDEX_NOT_USED. This is documented (docs/reference/statements/in.mdx: "A set written to disk while it is built cannot be used by the primary key or data skipping indexes"). CI hit it with --max_bytes_before_external_set 29596895. Clamp both thresholds to 0 on the existing Random settings limits line (the runner reads only the first such line); other settings stay random. Same fix as ClickHouse#126623 for 02844_subquery_timeout_with_break. 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) and my own cold review (0 findings). Test-only change; nothing to adjudicate. Session id: cron:clickhouse-review-slot-9:20261019-114300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261019-112900 |
|
Workflow [PR], commit [b25c6c7] Summary: ✅ AI ReviewSummaryThis test-only change disables randomized spilling of the Final VerdictStatus: ✅ Approve. Both spill thresholds are covered by the runner's existing limit mechanism. The unchanged regression assertions pass in the PR's Fast test report. |
|
cc @nihalzp, could you review this and add the |
788e854
Backport #126681 to 26.10: Keep the set of `IN` in memory in `00673_subquery_prepared_set_performance`
Since ClickHouse#124907 the runner randomizes max_bytes_before_external_set and max_bytes_ratio_before_external_set. A draw below the memory of an IN set (CI: 1215 bytes) makes the set spill while it is built. A spilled set keeps no explicit elements, so KeyCondition does not use it, partition pruning keeps all 3 partitions, and EXPLAIN ESTIMATE reports 3 parts instead of 2 in the "Non-safe cast" section (results stay correct; documented in docs/reference/statements/in.mdx). The LowCardinality, Nullable and LowCardinality(Nullable) set sections lose pruning the same way for a smaller draw. The test checks pruning by the in-memory set, so clamp both thresholds to 0 with a Random settings limits line; every other setting stays random. Same fix as ClickHouse#126681 (00673) and ClickHouse#126623 (02844). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #124907
Related: #126623
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
00673_subquery_prepared_set_performancefails withPrimary key (x) is not used and setting 'force_primary_key' is set. (INDEX_NOT_USED)in Stateless tests (arm_binary, AsyncInsert, s3 storage, parallel) with--max_bytes_before_external_set 29596895(105/105 reruns with the same settings fail, 141/141 pass without randomization).Since #124907 the runner randomizes the spill thresholds of the set of
IN. A threshold below the memory of the 1M-key set makes the set spill while it is built, and such a set is not used by the primary key by design (docs), soforce_primary_key = 1throws. The test checks the in-memory set, so it now clamps both thresholds to 0 on its existingRandom settings limitsline; other settings stay random. Same fix as #126623 for02844_subquery_timeout_with_break. #106734 pins onlymax_bytes_before_external_setin this test; the ratio threshold can also spill the set when little memory is left under the server or user limit, so both are clamped here.Validation: with the CI value the query throws and spills, with 0 it returns the row; with the runner's draw forced to the CI value the test fails 10/10 without the clamp and passes 5/5 with it; 50/50 randomized runs pass, and
system.query_logshowsmax_bytes_ratio_before_external_set = 0in all 50.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/126681]
Version info
26.11.1.282-master(included in26.11and later)26.10.2.30