Repository navigation
AST fuzzer oracle: skip SEMI joins like ANY joins - #127260
Conversation
A SEMI join takes the other side's columns from an arbitrary matching row, like ANY: RIGHT SEMI runs the RIGHT ANY hash-join branch, where the first left row that probes a key is used for all of its right rows, and LEFT SEMI keeps one stored right row per key. TLP WHERE runs the reference and its three partitions as separate queries and each one picks again, so an exhaustive partition can disagree on those columns. `hasNonDeterministicJoinAnywhere` skipped ASOF and ANY joins for this reason but not SEMI, and 05339 reported a false `TLP WHERE oracle mismatch` on a fuzzed `SEMI RIGHT JOIN` in two targeted CI jobs. On master the pick happens to be stable at the `max_threads = 1` the oracle uses for its sub-queries (the mismatch did not appear in 40 local rounds), but at `max_threads = 3` the reference query returns a different left `id` from run to run, and SEMI semantics allow any matching row. ANTI stays eligible: the other side's columns are always defaults (or NULL with `join_use_nulls`), so no row is picked. 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 my own cold review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261021-191300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261021-182500 |
|
cc @PedroTadim @qoega, could you review this and add the |
|
Workflow [PR], commit [d71895e] Summary: ❌
AI ReviewSummaryThe PR excludes Final VerdictStatus: ✅ Approve |
CI finish ledger - a41c5d7Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261021-233002 |
a8fbea0
Related: #124149
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05339_ast_fuzzer_oracle_distributed_plan_read_capfailed twice withTLP WHERE oracle mismatchon a fuzzedSEMI RIGHT JOIN(amd_tsan, s3 storage, targeted, arm_asan_ubsan, targeted), both in the targeted jobs of #126945. In both, the two sides have the same row count and differ only in the left table'sid.Root cause. A
SEMIjoin takes the other side's columns from an arbitrary matching row, likeANY:RIGHT SEMIruns the same hash-join branch asRIGHT ANY, where the first left row that probes a key is used for all of its right rows. TLP WHERE runs the reference and its three partitions as separate queries, and each one can pick a different row.hasNonDeterministicJoinAnywhereskipsASOFandANYjoins for this reason, but notSEMI.Change. Skip
SEMIjoins in the same check, as #124149 did forANY. It covers the query, its subqueries and the stored definitions it reads.ANTIis still checked: the other side's columns are always defaults (orNULLwithjoin_use_nulls), so no row is picked. The open #117187 keepsSEMIeligible as deterministic; that holds only for the preserved side's columns, and both failures read the other side'sid.Validation. At
max_threads = 3the reference query returns a different leftidfrom run to run (5 values in 8 runs). The oracle runs its sub-queries withmax_threads = 1, where master happens to pick the same row each time, so in 40 local rounds the mismatch did not appear on master. In the same rounds, 219SEMIqueries reached TLP WHERE without the change and 0 with it, whileANTIand join-free queries are still checked. With the change, 05339 passed 50 of 50 randomized runs. No new test, as for #124149.Workflow [PR]
Sync PR [sync-upstream/pr/127260]
Version info
26.11.1.790-master(included in26.11and later)