Repository navigation
feat: Support parenthesized JOIN ... ON constraints in SQL - #28967
Merged
Merged
Conversation
`process_join_constraint` matched `JoinConstraint::On` behind a pattern guard on `SQLExpr::BinaryOp`. sqlparser wraps a parenthesized expression in `SQLExpr::Nested`, which does not match that guard, so any `ON` clause with a paren at its root fell through to the catch-all and bailed with "unsupported SQL join constraint" — even for a single condition, `ON (a.x = b.x)`. The guard was redundant: `process_join_on` already strips `Nested` recursively and has its own catch-all with a more specific message. Removing it lets the callee handle the case it was written for, and moves malformed-expression errors from the constraint level down to the expression level where they belong. The remaining variants reaching the outer catch-all (empty `USING`, `None`) are still accurately described by its message. The test list includes two forms that pass without this change: the root-level `AND` of two parenthesized conditions, kept as a regression guard, and the non-equi condition, which additionally covers the `join_where` path. On TPC-DS this takes 54 of 99 queries from matching DuckDB to 58, and clears the join constraint error on 6 more that then hit unrelated gaps (`ROLLUP`, `sum(sum(x)) OVER`, date arithmetic, keyword table aliases). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2qrYK1WzWYdzKNgEHvQ7a
ritchie46
requested review from
MarcoGorelli,
alexander-beedie,
c-peters and
orlp
as code owners
August 25, 2026 09:39
Contributor
|
The uncompressed lib size after this PR is 60.9927 MB. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28967 +/- ##
==========================================
- Coverage 81.60% 81.59% -0.02%
==========================================
Files 1889 1890 +1
Lines 268638 268755 +117
Branches 3264 3264
==========================================
+ Hits 219233 219298 +65
- Misses 48560 48612 +52
Partials 845 845 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Quite a simple one, made with opus 5.