Skip to content

Support Snowflake Update-From-Select #1604

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 9 commits into from
Dec 24, 2024
Merged

Conversation

yuval-illumex
Copy link
Contributor

@yuval-illumex yuval-illumex commented Dec 16, 2024

The following query works in Snowflake:

UPDATE t1 FROM ( SELECT name, id FROM t1 GROUP BY id ) AS t2 SET name = t2.name WHERE t1.id = t2.id

Today the parser only supports update-set-from

@yuval-illumex
Copy link
Contributor Author

Thank you @iffyio for your feedback, I asked your opinion in one of the comments.

@yuval-illumex
Copy link
Contributor Author

yuval-illumex commented Dec 22, 2024

@iffyio appreciate your feedback again 🙏

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.

Left a couple comments, otherwise this looks good to me overall!

@@ -941,6 +941,7 @@ pub const RESERVED_FOR_TABLE_ALIAS: &[Keyword] = &[
// Reserved for Snowflake table sample
Keyword::SAMPLE,
Keyword::TABLESAMPLE,
Keyword::FROM,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this change related to the PR (wasn't clear to me if so)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.
When removing this as a keyword the following error occurs:
Error during parsing: ParserError("Expected: ), found: t1 at Line: 9, Column: 13")

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

yuval-illumex and others added 2 commits December 24, 2024 13:04
Comments

Co-authored-by: Ifeanyi Ubah <[email protected]>
Change parameter

Co-authored-by: Ifeanyi Ubah <[email protected]>
@alamb alamb merged commit 024a878 into apache:main Dec 24, 2024
8 checks passed
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.

3 participants