Skip to content

Conversation

Dimchikkk
Copy link
Contributor

Fixes #1904.

The bug was introduced in #1799.

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @Dimchikkk! Left a couple comments

let mut relation = self.parse_table_factor()?;

if self.peek_parens_less_nested_join() {
if dialect_of!(self is SnowflakeDialect) && self.peek_parens_less_nested_join() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to a dialect method that is only set to true for snowflake? e.g. if self.dialect.supports_parens_less_nested_join() && self.peek_parens_less_nested_join()


#[test]
fn join_precedence() {
all_dialects_except(|d| d.is::<SnowflakeDialect>()).verified_query_with_canonical(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By switching to the dialect method, we would be able to change these to use all_dialects_where(|d|d.supports_parens_less_nested_join())

@Dimchikkk
Copy link
Contributor Author

Thanks for the review, @iffyio - I've addressed your feedback and it’s ready for another round when you are.

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again @Dimchikkk!
cc @alamb

false
}

/// Indicates whether the dialect supports left-associative join parsing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice thanks for the description!

@iffyio iffyio merged commit 3bc9423 into apache:main Jun 28, 2025
10 checks passed
Dimchikkk added a commit to Dimchikkk/datafusion-sqlparser-rs that referenced this pull request Jul 2, 2025
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.

Wrong join precedence parsing for non-Snowflake dialects (nested joins parsed incorrectly)

2 participants