Repository navigation
fix(joins): single-equality RIGHT JOIN layout + operand routing (P63, P64) - #104
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RIGHT JOINtook the hash path as a LEFT join with the tables swapped and kept that swapped layout, soa.*/b.*were exchanged on every row (P8's fault, on the hash path). Newhash_join_right, sharingright_join_result_table(factored out ofnested_loop_join_right_multi) so both RIGHT builders use one layout.b.id = a.partner_idran asa.id = b.partner_idwhenever both tables hold both columns (self-joins). This hit INNER, LEFT and RIGHT. Operands are now routed with P7'soperand_uses_rightand swapped, with the operator reversed, before resolution.Verification
--checkholds.tests/join_operand_order_tests.rsover an asymmetricedgestable: both operand orders, plus hash path vs nested loop.cargo test, Python tests (572 passed) and FORMAL examples are green.expander_rewriterssmoke also fails on main (unrelated).🤖 Generated with Claude Code