Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support arbitrary composite access expressions #1600

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

ayman-sigma
Copy link
Contributor

Right now the CompositeAccess expression is limited to support the PostgreSQL syntax like SELECT (on_hand.item).name FROM on_hand WHERE (on_hand.item).price > 9.
This PR generalize it to support arbitrary composite access expressions. CompositeAccess expression is any prefix expression followed by a period then an identifier. The CompositeAccess itself can also be nested.

This change fixes issues with dialects that can access fields from another expression. For example dialects that supports struct literal. Something like SELECT struct(1 as a).a wouldn't work before this PR.

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

@ayman-sigma ayman-sigma force-pushed the ayman/supportArbitraryCompositeAccess branch from 38edcd8 to 978f81e Compare December 18, 2024 21:49
@ayman-sigma ayman-sigma force-pushed the ayman/supportArbitraryCompositeAccess branch from 978f81e to 3935b76 Compare December 19, 2024 00:21
@iffyio iffyio merged commit cd898cb into apache:main Dec 22, 2024
8 checks passed
@alamb
Copy link
Contributor

alamb commented Dec 28, 2024

ayman-sigma added a commit to sigmacomputing/sqlparser-rs that referenced this pull request Jan 3, 2025
This brings couple of fixes I put for databricks and bigquery:

- apache#1598
- apache#1600
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants