-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-21112] [SQL] ALTER TABLE SET TBLPROPERTIES should not overwrite COMMENT #18318
Conversation
cc @wzhfy @cloud-fan |
@@ -235,7 +235,7 @@ case class AlterTableSetPropertiesCommand( | |||
// direct property. | |||
val newTable = table.copy( | |||
properties = table.properties ++ properties, | |||
comment = properties.get("comment")) | |||
comment = properties.get("comment").orElse(table.comment)) |
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.
What about UNSET TBLPROPERTIES command?
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.
This looks fine. However, when setting properties for Hive table, a None
comment will be ignored and won't override the comment.
We don't do similar thing in InMemoryCatalog
and just override it with the None
comment.
Not sure if we should fix it here or in InMemoryCatalog
.
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.
Could you show an example?
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 src set tblproperties ('foo' = 'bar', 'comment' = 'table_comment');
alter table src unset tblproperties ('foo');
we will lost comment in this case.
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.
Thanks!
Test build #78123 has finished for PR 18318 at commit
|
LGTM, merging to master! |
is it also a problem for other branches? |
Only the master branch has such an issue. Thanks! |
… COMMENT ### What changes were proposed in this pull request? `ALTER TABLE SET TBLPROPERTIES` should not overwrite `COMMENT` even if the input property does not have the property of `COMMENT`. This PR is to fix the issue. ### How was this patch tested? Covered by the existing tests. Author: Xiao Li <gatorsmile@gmail.com> Closes apache#18318 from gatorsmile/fixTableComment.
What changes were proposed in this pull request?
ALTER TABLE SET TBLPROPERTIES
should not overwriteCOMMENT
even if the input property does not have the property ofCOMMENT
. This PR is to fix the issue.How was this patch tested?
Covered by the existing tests.