-
Notifications
You must be signed in to change notification settings - Fork 601
Add support for MSSQL's OPENJSON WITH
clause
#1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blocker for me ! This would be of great use for us at SQLPage, where the use of sql json functions is common.
src/parser/mod.rs
Outdated
@@ -10000,7 +10000,7 @@ impl<'a> Parser<'a> { | |||
table_with_joins: Box::new(table_and_joins), | |||
alias, | |||
}) | |||
} else if dialect_of!(self is SnowflakeDialect | GenericDialect) { | |||
} else if dialect_of!(self is SnowflakeDialect | GenericDialect | MsSqlDialect) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to update the comments below too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah to @lovasoa's suggestion, one double check on my end @gaoqiangz is the parenthesis around the joined table supported syntax for the openjson syntax? Thinking if its not, then we would be able to skip this change entirely. If it is then indeed lets update the comments to account for mssql.
Additionally, can we add a test case covering the behavior (as in a roundtrip test like SELECT ... FROM T AS A CROSS APPLY (OPENJSON(...) WITH ...) AS B
so that we catch any regression on the behavior going forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked that MSSQL doesn't support parenthesis around the openjson syntax.
I'll revert this change.
src/parser/mod.rs
Outdated
@@ -10000,7 +10000,7 @@ impl<'a> Parser<'a> { | |||
table_with_joins: Box::new(table_and_joins), | |||
alias, | |||
}) | |||
} else if dialect_of!(self is SnowflakeDialect | GenericDialect) { | |||
} else if dialect_of!(self is SnowflakeDialect | GenericDialect | MsSqlDialect) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah to @lovasoa's suggestion, one double check on my end @gaoqiangz is the parenthesis around the joined table supported syntax for the openjson syntax? Thinking if its not, then we would be able to skip this change entirely. If it is then indeed lets update the comments to account for mssql.
Additionally, can we add a test case covering the behavior (as in a roundtrip test like SELECT ... FROM T AS A CROSS APPLY (OPENJSON(...) WITH ...) AS B
so that we catch any regression on the behavior going forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! cc @alamb
Pull Request Test Coverage Report for Build 11716305539Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
🚀 |
Resolves issue #1494