-
Notifications
You must be signed in to change notification settings - Fork 750
Databricks: support INSERT BY NAME #2403
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18338,6 +18338,7 @@ impl<'a> Parser<'a> { | |||||||||
|
|
||||||||||
| let is_mysql = dialect_of!(self is MySqlDialect); | ||||||||||
|
|
||||||||||
| let mut by_name = false; | ||||||||||
| let (columns, partitioned, after_columns, output, source, assignments) = if self | ||||||||||
| .parse_keywords(&[Keyword::DEFAULT, Keyword::VALUES]) | ||||||||||
| { | ||||||||||
|
|
@@ -18348,6 +18349,9 @@ impl<'a> Parser<'a> { | |||||||||
| self.parse_parenthesized_qualified_column_list(Optional, is_mysql)?; | ||||||||||
|
|
||||||||||
| let partitioned = self.parse_insert_partition()?; | ||||||||||
| by_name = columns.is_empty() | ||||||||||
| && self.dialect.supports_insert_by_name() | ||||||||||
|
Comment on lines
+18352
to
+18353
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think we can drop the columns check? its not clear why it would be needed at this layer, if the implication is something semantic then that can be left up to the consumer to validate. Relatedly, I assume we need to only set the name if we don't already have one (can we cover that scenario in the tests)? |
||||||||||
| && self.parse_keywords(&[Keyword::BY, Keyword::NAME]); | ||||||||||
| // Hive allows you to specify columns after partitions as well if you want. | ||||||||||
| let after_columns = if dialect_of!(self is HiveDialect) { | ||||||||||
| self.parse_parenthesized_column_list(Optional, false)? | ||||||||||
|
|
@@ -18472,6 +18476,7 @@ impl<'a> Parser<'a> { | |||||||||
| ignore, | ||||||||||
| into, | ||||||||||
| overwrite, | ||||||||||
| by_name, | ||||||||||
| partitioned, | ||||||||||
| columns, | ||||||||||
| after_columns, | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless the syntax conflicts with other dialects (doesn't seem to be the case?) I think we can skip the dialect method and let the parser be permissive?