Repository navigation
Randomize query_plan_optimize_join_order_randomize in stateles - #105995
Conversation
|
Workflow [PR], commit [8beff7b] Summary: ✅ AI ReviewSummaryThis PR moves Findings
Missing context / blind spots
Final Verdict |
4e485d2 to
7416f26
Compare
7416f26 to
4b6a5a0
Compare
| @@ -1584,7 +1584,6 @@ class SettingsRandomizer: | |||
| } | |||
There was a problem hiding this comment.
Moving query_plan_optimize_join_order_randomize out of stress_test_only_settings makes normal random-settings failures depend on this value being replayable. The generator still emits 1 10% of the time, and QueryPlanOptimizationSettings expands 1 with randomSeed, but save_random_settings_artifact only records the original setting value. A failed stateless test would therefore be saved as query_plan_optimize_join_order_randomize=1, and --diagnose-random-settings would rerun it with a different join-order seed, so the failure cannot be reliably reproduced or minimized. Please make the normal randomizer emit only concrete seeds (>= 2), or materialize the generated seed before saving/rerunning the test.
There was a problem hiding this comment.
We print randomization seed in server logs
| @@ -1,3 +1,5 @@ | |||
| SET query_plan_optimize_join_order_randomize = 0; -- TODO: TOTALS over CROSS JOIN with constant table loses build-side values when the join is swapped (pre-existing bug) | |||
6cfb240 to
ca2c8b8
Compare
| ${CLICKHOUSE_CLIENT} -q "create table country_polygons(name String, p Array(Array(Tuple(Float64, Float64)))) engine=Memory()" | ||
| cat ${CURDIR}/country_polygons.tsv | ${CLICKHOUSE_CLIENT} -q "insert into country_polygons format TSV" | ||
| ${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionSpherical(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_polygons AS first CROSS JOIN country_polygons AS second LIMIT 100) format TSV" | ||
| ${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionSpherical(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_polygons AS first CROSS JOIN country_polygons AS second LIMIT 100) ORDER BY c, d format TSV" |
There was a problem hiding this comment.
Placing ORDER BY outside this subquery does not make the test deterministic: the inner LIMIT 100 still selects whichever first 100 rows the CROSS JOIN produces. Once query_plan_optimize_join_order_randomize is injected in normal stateless runs, the join can be planned/probed in the opposite order, so a different 100 country pairs can be selected before the outer sort and the reference can still change. Please either pin query_plan_optimize_join_order_randomize = 0 for this query or move a deterministic ORDER BY first.name, second.name before LIMIT 100 inside the subquery.
ca2c8b8 to
2bf018b
Compare
| SELECT t FROM ttta, tttb; | ||
| SELECT t.t.t FROM ttta, tttb; | ||
| SELECT t.t.t.t.t FROM ttta, tttb; | ||
| SELECT t FROM ttta, tttb ORDER BY ALL; |
There was a problem hiding this comment.
Adding ORDER BY only to these CROSS JOIN outputs does not make the test safe under the new normal randomizer. The same file still has later multi-row FULL JOIN outputs over ttta/tttb and nnna/nnnb without ordering, and optimizeJoin can still treat a two-relation FULL join as swap-only. In a randomized stateless run where query_plan_join_swap_table = 'auto', randomized relation stats from query_plan_optimize_join_order_randomize can flip the physical sides and change the emitted row order, so this test can still produce different references depending on the generated seed. Please either pin query_plan_optimize_join_order_randomize = 0 near the existing SET join_algorithm = 'hash', or sort every multi-row join result in the file.
| @@ -1585,7 +1585,6 @@ class SettingsRandomizer: | |||
| } | |||
|
|
|||
| stress_test_only_settings = { | |||
There was a problem hiding this comment.
Moving query_plan_optimize_join_order_randomize into normal stateless random settings still leaves at least one side-sensitive EXPLAIN test unpinned. tests/queries/0_stateless/04300_dedup_subtrees_on_filter_merge.sql:14 expects the join action text to contain __table2; normal runs already randomize query_plan_join_swap_table to auto, and with this new randomized stats seed the two equal numbers(10000) inputs can get different synthetic row counts and flip the physical join side. That makes the countIf(... __table2 ...) assertion report 0 depending on the generated seed. Please pin query_plan_optimize_join_order_randomize = 0 or query_plan_join_swap_table = false in that test before enabling this setting globally.
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 92 line(s), 1 function(s) across 40 file(s) · Details Top files
|
|
Hi @vdimir @KochetovNicolai — a couple of suggestions to make this PR easier for reviewers and the changelog reader. Title (currently
Description (currently
Ignore this if the current title/body is intentional. |
…-join-order-stateless Randomize query_plan_optimize_join_order_randomize in stateles
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):