fix(RF01): support parenthesized joined tables in FROM clause#2245
Open
fix(RF01): support parenthesized joined tables in FROM clause#2245
Conversation
Benchmark for cdbba8bClick to view benchmark
|
Add support for parsing and analyzing parenthesized joined tables like: `FROM a CROSS JOIN (b JOIN c ON b.id = c.b_id)` Changes: - Add JoinTargetGrammar in ANSI dialect that allows either a simple table expression or a bracketed FROM expression as join targets - Update JoinClauseSegment to use JoinTargetGrammar - Update JoinClauseSegment::eventual_aliases() to extract table aliases from bracketed FromExpression segments Fixes #1573 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3273ebd to
d6118f7
Compare
Benchmark for b62b564Click to view benchmark
|
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
Fixes #1573
This PR adds support for parsing and analyzing parenthesized joined tables in FROM clauses, such as:
Previously, sqruff would fail to parse the parenthesized join expression and the RF01 rule would incorrectly report that table aliases like
candciwere not found in the FROM clause.Changes
JoinTargetGrammarin ANSI dialect that allows either:FromExpressionElementSegment(simple table)Bracketed(FromExpressionSegment)(parenthesized joined tables)JoinClauseSegmentto useJoinTargetGrammarinstead ofFromExpressionElementSegmentJoinClauseSegment::eventual_aliases()to extract table aliases from bracketedFromExpressionsegmentsTest plan
cargo clippyandcargo fmt🤖 Generated with Claude Code