Repository navigation
Fix flaky 04490_join_runtime_filters_index_analysis - #112467
Conversation
|
Workflow [PR], commit [a7b4e3e] Summary: ✅ AI ReviewSummaryThis PR stabilizes Findings
Final VerdictChanges requested: extend the same pin to the sibling runtime-filter tests that still rely on randomized |
| -- Left-side join pruning is intentionally disabled under parallel replicas, so pin PR off to | ||
| -- exercise the feature (the ParallelReplicas CI job otherwise forces it on). | ||
| SET enable_parallel_replicas = 0; | ||
| SET join_runtime_filter_min_probe_rows = 0; |
There was a problem hiding this comment.
This pin is correct for 04490, but it leaves the same random-settings failure mode in the sibling pruning tests. The stateless runner injects --join_runtime_filter_min_probe_rows before the file, and only an explicit SET/SETTINGS or a no-random-settings tag overrides it; that is why the failing seed here (6894) suppressed BuildRuntimeFilter and turned the expected RuntimeFilterGranules* rows from 1/1 into 0/0.
04611_join_runtime_filters_index_analysis_skip_index.sql, 04612_join_runtime_filters_index_analysis_multi_key_anti.sql, and 04498_join_runtime_filters_multihop.sql still assert RuntimeFilterGranules* > 0 on 2000-row probe sides without pinning this setting, so the same probe_size <= join_runtime_filter_min_probe_rows branch can still disable the filter there. Please apply the same SET join_runtime_filter_min_probe_rows = 0 (or opt those files out of random settings) as part of the fix.
There was a problem hiding this comment.
@groeneai make correspoding changes in this PR
There was a problem hiding this comment.
Measured all four files on a master debug build (26.8.1.1, 74a068f2), running each unmodified against its .reference with --join_runtime_filter_min_probe_rows injected as a client option, then again with the pin added. Two things came out different from the bot comment.
04611 and 04612 reproduce; 04498 does not.
| test | default | injected 10000 | injected 10000 + pin |
|---|---|---|---|
| 04490 | pass | fail (6 rows 1 1 -> 0 0) |
pass |
| 04611 | pass | fail (1 1 -> 0 0) |
pass |
| 04612 | pass | fail (1 1 -> 0 0) |
pass |
| 04498 | pass | pass | pass |
04498 passes across the whole randomizer range (randint(1, 10000): tested 1, 2, 10, 100, 500, 999, 1000, 1001, 2000, 3000, 5000, 8000, 9999, 10000). The reason is in the guard's input rather than in the guard: join_runtime_filter_min_probe_rows is only consulted through join_step->getInputRowsEstimation(JoinTableSide::Left) (joinRuntimeFilter.cpp:253), and left_rows_estimation is populated at exactly one place, join_step->setOptimized(entry->estimated_rows, lhs_estimation, rhs_estimation, ...) inside the join reordering loop (optimizeJoin.cpp:1375). 04498 pins SET query_plan_optimize_join_order_limit = 0, so optimizeJoin takes the early return at optimizeJoin.cpp:1521-1530 and calls setOptimized() with no arguments, leaving left_rows_estimation as nullopt. The probe_size && *probe_size <= ... test at :254 then cannot fire at any threshold value.
Both directions check out: removing only that SET from 04498 makes it fail under injection 10000 while still passing at the default, and adding SET query_plan_optimize_join_order_limit = 0 to 04612 makes 04612 pass under injection 10000.
04498 is still worth pinning, for a different reason. query_plan_optimize_join_order_limit is itself randomized (clickhouse-test:1649, 0 with probability 0.05 else one of 1/5/10/20/64), so 04498's immunity rests on its own file-level SET winning over the injected value. That holds today, but it makes the immunity incidental rather than structural, so the pin is cheap insurance rather than a no-op guard against a reproducing failure.
#111691 already does all of this. @ alexey-milovidov's open PR adds SET join_runtime_filter_min_probe_rows = 0 to 04490, 04498, 04611, 04612 and 04493, one line each, immediately after SET enable_join_runtime_filters = 1. So the sibling coverage the bot asked for already exists there and is not missing from the tree, only unmerged.
That leaves a merge-order detail rather than a missing fix: git merge-tree of the two heads resolves cleanly (both insertions are at different offsets), but the merged 04490 then carries the pin twice, at lines 32 and 39. Harmless, just redundant.
Given that, my suggestion is to leave this PR as the single-line 04490 fix and let #111691 carry the three siblings, since it already has them and also covers 04493 which is outside this PR's scope. If you would rather have the siblings here so 04490 does not wait on #111691, the diff is one line per file, inserted right after each file's existing SET enable_parallel_replicas = 0;:
--- a/tests/queries/0_stateless/04611_join_runtime_filters_index_analysis_skip_index.sql
+++ b/tests/queries/0_stateless/04611_join_runtime_filters_index_analysis_skip_index.sql
@@ -11,6 +11,7 @@
-- Left-side join pruning is intentionally disabled under parallel replicas, so pin PR off to
-- exercise the feature (the ParallelReplicas CI job otherwise forces it on).
SET enable_parallel_replicas = 0;
+SET join_runtime_filter_min_probe_rows = 0;
-- Bloom filter in skip index
DROP TABLE IF EXISTS bf_fact;
--- a/tests/queries/0_stateless/04612_join_runtime_filters_index_analysis_multi_key_anti.sql
+++ b/tests/queries/0_stateless/04612_join_runtime_filters_index_analysis_multi_key_anti.sql
@@ -22,6 +22,7 @@
-- Left-side join pruning is intentionally disabled under parallel replicas, so pin PR off to
-- exercise the feature (the ParallelReplicas CI job otherwise forces it on).
SET enable_parallel_replicas = 0;
+SET join_runtime_filter_min_probe_rows = 0;
CREATE TABLE mk_fact (a UInt64, b UInt64, v UInt64)I verified both of those exact insertions pass at the default and under injection 10000, and that they do not change any other assertion in either file. I have no push access to this branch, so this is a paste rather than a commit. I went with the targeted SET over no-random-settings since only this one setting is at fault and the tag would drop the rest of the coverage.
…erministic_condition The test asserts that a JOIN runtime filter is still moved into PREWHERE under FINAL. It pinned enable_join_runtime_filters but not the threshold the optimizer compares the probe-side ROW ESTIMATE against, and that estimate is not the real row count: query_plan_optimize_join_order_randomize, randomized by the test runner, replaces it with a uniform draw in [1, 10000000]. With the drawn pair (688112, 5964) the estimate becomes 5135, the filter is declined for a seemingly small probe side, and the assertion reads 0 instead of 1. Pin the threshold to 0, which is documented to always build the filter, so the assertion no longer depends on an estimate. Same shape as ClickHouse#111691 and ClickHouse#112467. The join order randomizer stays unpinned on purpose, so this test keeps exercising randomized join statistics. At a zero threshold the runtime-filter pass reads no row estimate, and it runs before the physical join is chosen, so a randomized estimate can no longer suppress the filter. It still varies the hash join implementation chosen afterwards; the assertion holds at both implementations observed. Co-Authored-By: Claude Opus 5 <[email protected]>
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107666&sha=df23e1d1e81fab78c6c717fdf63b6928f95461a5&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Version info
26.8.1.415(included in26.8and later)