-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29643][SQL] ALTER TABLE/VIEW (DROP PARTITION) should look up catalog/table like v2 commands #26303
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
Conversation
|
Test build #112880 has finished for PR 26303 at commit
|
|
This command doesn't need to follow #26041. |
| | ALTER TABLE tableIdentifier | ||
| | ALTER TABLE multipartIdentifier | ||
| DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* PURGE? #dropTablePartitions | ||
| | ALTER VIEW tableIdentifier |
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.
Since view is not supported, can we just combine this with table as (TABLE | VIEW)? @cloud-fan can confirm.
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.
Can we check if the feature sets are the same between table and view? I know some ALTER TABLE commands have a view version in the parser, but not sure if it applies to all ALTER TABLE commands.
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.
If there are only a few ALTER VIEW parser rules, let's keep them separated.
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.
ALTER TABLE ... DROP PARTITION has an optional PURGE in the end, but ALTER TABLE doesn't. I guess keep them separated? They use the same parser rule, though.
| | ALTER TABLE tableIdentifier | ||
| from=partitionSpec RENAME TO to=partitionSpec #renameTablePartition | ||
| | ALTER TABLE tableIdentifier | ||
| | ALTER TABLE multipartIdentifier |
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.
nit: one space not two
| | ALTER TABLE multipartIdentifier | ||
| DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* PURGE? #dropTablePartitions | ||
| | ALTER VIEW tableIdentifier | ||
| DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* #dropTablePartitions |
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.
Sorry I missed it. These 2 parser rules share the same label, so they are essentially one rule.
I agree with @imback82 that it's better to merge them:
ALTER TABLE | VIEW multipartIdentifier
DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* PURGE?
ea3c66c to
163e448
Compare
|
Please also update the PR title (adding VIEW). |
|
Test build #112992 has finished for PR 26303 at commit
|
|
retest this please |
|
Test build #113004 has finished for PR 26303 at commit
|
|
retest this please |
|
Test build #113026 has finished for PR 26303 at commit
|
|
retest this please |
|
retest this please. |
|
Test build #113040 has finished for PR 26303 at commit
|
|
Test build #113049 has finished for PR 26303 at commit
|
faa2361 to
07dbe47
Compare
|
Test build #113076 has finished for PR 26303 at commit
|
|
thanks, merging to master! |
|
Thanks! @cloud-fan @viirya @imback82 |
What changes were proposed in this pull request?
Add AlterTableDropPartitionStatement and make ALTER TABLE/VIEW ... DROP PARTITION go through the same catalog/table resolution framework of v2 commands.
Why are the changes needed?
It's important to make all the commands have the same table resolution behavior, to avoid confusing end-users. e.g.
Does this PR introduce any user-facing change?
Yes. When running ALTER TABLE/VIEW ... DROP PARTITION, Spark fails the command if the current catalog is set to a v2 catalog, or the table name specified a v2 catalog.
How was this patch tested?
Unit tests.