-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21119][SQL] unset table properties should keep the table comment #18325
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
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 | ||
|---|---|---|---|---|
|
|
@@ -264,14 +264,14 @@ case class AlterTableUnsetPropertiesCommand( | |||
| DDLUtils.verifyAlterTableType(catalog, table, isView) | ||||
| if (!ifExists) { | ||||
| propKeys.foreach { k => | ||||
| if (!table.properties.contains(k)) { | ||||
| if (!table.properties.contains(k) && k != "comment") { | ||||
| throw new AnalysisException( | ||||
| s"Attempted to unset non-existent property '$k' in table '${table.identifier}'") | ||||
| } | ||||
| } | ||||
| } | ||||
| // If comment is in the table property, we reset it to None | ||||
| val tableComment = if (propKeys.contains("comment")) None else table.properties.get("comment") | ||||
| val tableComment = if (propKeys.contains("comment")) None else table.comment | ||||
|
||||
| table.comment.foreach { c => hiveTable.setProperty("comment", c) } |
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.
Oh. I see. It goes to override the original table metadata if no comment is set.
Uh oh!
There was an error while loading. Please reload this page.
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.
In above code not shown in this diff, we check if a prop key exists in table.properties or not when
ifExistsis false. Ascommentis not in table.properties, I think it will causeAnalysisExceptionwhen unset comment?