Repository navigation
AST fuzzer oracle: run sub-queries with Dynamic JOIN keys disallowed - #127078
Conversation
The fuzzer profile enables `allow_dynamic_type_in_join_keys`, and the oracle context copied it. With it on, the TLP `WHERE p` arm turns a `Dynamic = UInt256` equality into a hash-join key compared after a cast to `Dynamic`, where a `UInt64` variant never equals a `UInt256` one, while the reference and the `not(p)` / `isNull(p)` arms keep a cross join with an `equals` filter. The forms then legitimately disagree (the limitation documented by ClickHouse#86358) and the oracle reported a false mismatch on `AST fuzzer (amd_release, oracle)`. Pin the setting off in `makeOracleContext`, next to the other settings that make rewrite forms disagree by design. It also overrides a session `compatibility <= 25.9`, which turns the setting on. The fuzzed query itself keeps the setting, so crash fuzzing of Dynamic join keys stays. 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 an own cold review (0 findings). Session id: cron:clickhouse-review-slot-9:20261021-004100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261021-001100 |
|
cc @qoega @PedroTadim, could you review this and add the |
|
Workflow [PR], commit [a67b057] Summary: ✅
AI ReviewSummaryThe PR pins Final VerdictStatus: ✅ Approve |
618b0fd
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Stop the AST fuzzer oracles from reporting false mismatches when a query compares a
Dynamiccolumn with a non-Dynamicone in a join.Description
AST fuzzer (amd_release, oracle)failed on the unrelated #109071 with a TLP Aggregate mismatch(report)
on
SELECT count() FROM big__fuzz_9, small__fuzz_1 WHERE (bid = sid) AND (v = sid), after the fuzzer had changedthe columns to
v Dynamicandsid UInt256.The fuzzer profile sets
allow_dynamic_type_in_join_keys = 1, and the oracle sub-queries inherited it. TheWHERE parm of the TLP rewrite then turns
v = sidinto a hash-join key onCAST(sid AS Dynamic), where aUInt64value neverequals a
UInt256one, so the arm returns 0. The reference and thenot(p)/isNull(p)arms keep a cross join withan
equalsfilter, which matches 200 pairs. These are the "unexpected results" #86358 cites for forbiddingDynamicJOIN keys by default.
The change pins the setting off in
QueryOracleChecker::makeOracleContext, next to the other settings that makerewrite forms disagree by design. This also covers a session
SET compatibility = '25.9', which turns it on. The fuzzedquery itself still runs with the setting on, so crash fuzzing of
Dynamicjoin keys is kept. An oracle sub-query with anexplicit
DynamicJOIN key now fails withILLEGAL_COLUMNand is skipped.No test, as in #125003.
Code: 906mismatches in 40 fuzzed rounds of the seed query on the fuzzed schema,clickhouse local:make_distributed_plan = 0make_distributed_plan = 1compatibility = '25.9'With this PR the TLP Aggregate oracle still runs on these queries and passes.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127078]
Version info
26.11.1.426-master(included in26.11and later)