Skip to content

fix(joins): single-equality RIGHT JOIN layout + operand routing (P63, P64) - #104

Merged
TimelordUK merged 2 commits into
mainfrom
fix/p63-right-join-hash
Oct 10, 2026
Merged

TimelordUK merged 2 commits into
mainfrom
fix/p63-right-join-hash

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Summary

  • P63: a single-equality RIGHT JOIN took the hash path as a LEFT join with the tables swapped and kept that swapped layout, so a.*/b.* were exchanged on every row (P8's fault, on the hash path). New hash_join_right, sharing right_join_result_table (factored out of nested_loop_join_right_multi) so both RIGHT builders use one layout.
  • P64 (found by P63's regression test): the simple-column resolver routed operands by where they are written, not by alias, so b.id = a.partner_id ran as a.id = b.partner_id whenever both tables hold both columns (self-joins). This hit INNER, LEFT and RIGHT. Operands are now routed with P7's operand_uses_right and swapped, with the operator reversed, before resolution.
  • Removed unused column-name params on the inner/left hash builders.

Verification

  • Parity 197 → 202 AGREE / 233. The diff against the saved baseline moves exactly the 2 P63 cases and the 3 new P64 cases; the P64 cases were pinned as DIFFER on main first. --check holds.
  • New Rust tests in tests/join_operand_order_tests.rs over an asymmetric edges table: both operand orders, plus hash path vs nested loop.
  • cargo test, Python tests (572 passed) and FORMAL examples are green. expander_rewriters smoke also fails on main (unrelated).

🤖 Generated with Claude Code

TimelordUK and others added 2 commits October 10, 2026 13:10
…3, P64)

P63: a single plain-column equality RIGHT JOIN ran the LEFT hash builder
with the tables swapped and kept the swapped layout, so a.* and b.* came
back exchanged on every row. New `hash_join_right` indexes the FROM table
and probes with each joined row; its result table comes from
`right_join_result_table`, factored out of `nested_loop_join_right_multi`
so the two RIGHT builders share one layout.

P64, found by P63's test: the simple-column resolver took the written-left
name in the FROM table and dropped the qualifier, so `b.id = a.partner_id`
ran as `a.id = b.partner_id` whenever both tables hold both columns (any
self-join), on INNER, LEFT and RIGHT. Operands are now routed by alias
with P7's `operand_uses_right` and swapped, operator reversed, before
their columns resolve.

Unused column-name parameters on the inner/left hash builders removed.
Parity 197 -> 202 AGREE / 233; the five cases that moved are exactly the
two P63 and three new P64 cases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@TimelordUK
TimelordUK merged commit b5e2e7e into main Oct 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant