Skip to content

Fix USING column binding for right joins#345

Merged
KKould merged 3 commits into
mainfrom
fix-326-using-right-filter-semantics
Jun 4, 2026
Merged

Fix USING column binding for right joins#345
KKould merged 3 commits into
mainfrom
fix-326-using-right-filter-semantics

Conversation

@KKould
Copy link
Copy Markdown
Member

@KKould KKould commented Jun 4, 2026

What problem does this PR solve?

Fixes #326.

RIGHT/FULL OUTER JOIN ... USING (...) should bind unqualified USING column references to the visible merged column. Before this change, RIGHT JOIN ... USING(a) WHERE a = 4 could bind a to the left side and filter out right-only rows incorrectly.

Issue link: #326

What is changed and how it works?

  • Track USING columns by name in the binder so unqualified references can resolve to the USING-visible expression first.
  • Bind RIGHT JOIN ... USING visible columns to the right-side column.
  • Bind FULL JOIN ... USING visible columns as coalesce(left, right).
  • Keep SELECT * duplicate-column hiding through the stored USING metadata.
  • Reject duplicate USING names across joins for now.

Code changes

  • Has Rust code change
  • Has CI related scripts change

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Manual test steps:

cargo fmt --check
cargo check
cargo run --quiet -p sqllogictest-test

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Note for reviewer

Full sqllogictest passed locally: 194 files.

@KKould KKould self-assigned this Jun 4, 2026
@KKould KKould added the enhancement New feature or request label Jun 4, 2026
@KKould KKould merged commit 6b4d7d7 into main Jun 4, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix RIGHT/FULL OUTER JOIN ... USING (...) filter semantics

1 participant