Skip to content

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