Skip to content

Fix incorrect parsing of JsonAccess bracket notation after cast in Snowflake #1708

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

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

yoavcloud
Copy link
Contributor

Some dialects support a size parameter for array type definitions, using bracket notation. For example: INT[100]. For other dialects, the bracket notation should be parsed as JsonAccess, for example in Snowflake this statement means to extract the second element after casting the JSONPath b.c from column a to an array: SELECT a:b:c::ARRAY[1].

This PR makes a distinction between these dialects to ensure the correct parsing of JsonAccess after a cast expression.

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 @yoavcloud!
cc @alamb

@iffyio iffyio changed the title Fix incorrect parsing of JsonAccess bracket notation after cast in Snowflae Fix incorrect parsing of JsonAccess bracket notation after cast in Snowflake Feb 6, 2025
@iffyio iffyio merged commit 86abbd6 into apache:main Feb 6, 2025
9 checks passed
ayman-sigma pushed a commit to sigmacomputing/sqlparser-rs that referenced this pull request Apr 10, 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.

2 participants