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
[SPARK-30679][SQL] REPLACE TABLE can omit the USING clause #27402
Conversation
Test build #117562 has finished for PR 27402 at commit
|
I actually don't like the fact that you can be accidentally changing the format your table is stored in, but if people think that's fine, I won't oppose this change |
val provider = ctx.tableProvider.multipartIdentifier.getText | ||
val defaultProvider = conf.defaultDataSourceName | ||
val provider = | ||
Option(ctx.tableProvider).map(_.multipartIdentifier.getText).getOrElse(defaultProvider) |
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.
The default provider should not be set here. The purpose of the statement logical plans is to carry only what was expressed in SQL. Replacing with a default loses the fact that this query had no provider specified.
Instead, this needs to update the statement plan and pass provider as an option.
I'm -1 on this because it incorrectly returns a statement that fills in information not in the user's SQL query. Defaults should be set later. |
Hi @rdblue , I just remind that, by design the default provider should be determined by the catalog implementation, not Spark. I think you are right that the statement should hold an |
Test build #117619 has finished for PR 27402 at commit
|
I am +1 with @brkyvz |
retest this please |
Seems no one is against allowing to omit the USING clause, but the question is what the default value should be. I see two options:
I'll go with option 2. |
Test build #117641 has finished for PR 27402 at commit
|
@@ -49,26 +49,6 @@ class DDLParserSuite extends AnalysisTest { | |||
comparePlans(parsePlan(sql), expected, checkAnalysis = false) | |||
} | |||
|
|||
test("SPARK-30098: create table without provider should " + |
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.
The default provider shouldn't be set by the parser. The newly added test case will test the default provider.
Test build #117651 has finished for PR 27402 at commit
|
Test build #117667 has finished for PR 27402 at commit
|
retest this please |
1 similar comment
retest this please |
Test build #118619 has finished for PR 27402 at commit
|
It's not a breaking change to allow to omit the provider in REPLACE TABLE, so I'll leave it to 3.1. The CREATE TABLE behavior should be fixed before 3.0: #27650 |
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
Test build #123361 has finished for PR 27402 at commit
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
What changes were proposed in this pull request?
This PR updates the parser rule to allow
REPLACE TABLE
statement to omit theUSING
clause.This is extracted from #27345
Why are the changes needed?
CREATE TABLE
can omit theUSING
clause, andREPLACE TABLE
should be consistent.Does this PR introduce any user-facing change?
yes, now it's easier to write
REPLACE TABLE
command.How was this patch tested?
a new test