Skip to content
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

snowflake: support for UNPIVOT and a fix for chained PIVOTs #983

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

jmhain
Copy link
Contributor

@jmhain jmhain commented Sep 25, 2023

This adds support for UNPIVOT, and also makes a change to the AST for PIVOT to represent more cases, such as pivoting a subquery or the result of another PIVOT / UNPIVOT (SF allows this, BQ does not). I implemented the latter case here but not the former - planning to do that in a follow-up.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @jmhain -- this looks good to me. I had one suggestion on how to make the code clearer, but we can do that as a follow on PR if you prefer.

name: ObjectName,
table_alias: Option<TableAlias>,
#[cfg_attr(feature = "visitor", visit(with = "visit_table_factor"))]
table: Box<TableFactor>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought about suggesting this field be named relation but calling it table is consistent with other AST nodes (like Merge) so I think this is good

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @jmhain 🙏

@alamb alamb merged commit 40e2ecb into apache:main Oct 2, 2023
lustefaniak pushed a commit to getsynq/sqlparser-rs that referenced this pull request Oct 26, 2023
lustefaniak added a commit to getsynq/sqlparser-rs that referenced this pull request Oct 26, 2023
serprex pushed a commit to serprex/sqlparser-rs that referenced this pull request Nov 6, 2023
@jmhain jmhain deleted the unpivot branch May 4, 2024 03:40
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