Skip to content
Snippets Groups Projects
Commit 5d35d5c1 authored by Xiao Li's avatar Xiao Li Committed by Wenchen Fan
Browse files

[SPARK-21112][SQL] ALTER TABLE SET TBLPROPERTIES should not overwrite 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 #18318 from gatorsmile/fixTableComment.
parent a18d6371
No related branches found
No related tags found
No related merge requests found
...@@ -235,7 +235,7 @@ case class AlterTableSetPropertiesCommand( ...@@ -235,7 +235,7 @@ case class AlterTableSetPropertiesCommand(
// direct property. // direct property.
val newTable = table.copy( val newTable = table.copy(
properties = table.properties ++ properties, properties = table.properties ++ properties,
comment = properties.get("comment")) comment = properties.get("comment").orElse(table.comment))
catalog.alterTable(newTable) catalog.alterTable(newTable)
Seq.empty[Row] Seq.empty[Row]
} }
......
...@@ -127,6 +127,7 @@ Provider parquet ...@@ -127,6 +127,7 @@ Provider parquet
Num Buckets 2 Num Buckets 2
Bucket Columns [`a`] Bucket Columns [`a`]
Sort Columns [`b`] Sort Columns [`b`]
Comment table_comment
Table Properties [e=3] Table Properties [e=3]
Location [not included in comparison]sql/core/spark-warehouse/t Location [not included in comparison]sql/core/spark-warehouse/t
Storage Properties [a=1, b=2] Storage Properties [a=1, b=2]
...@@ -157,6 +158,7 @@ Provider parquet ...@@ -157,6 +158,7 @@ Provider parquet
Num Buckets 2 Num Buckets 2
Bucket Columns [`a`] Bucket Columns [`a`]
Sort Columns [`b`] Sort Columns [`b`]
Comment table_comment
Table Properties [e=3] Table Properties [e=3]
Location [not included in comparison]sql/core/spark-warehouse/t Location [not included in comparison]sql/core/spark-warehouse/t
Storage Properties [a=1, b=2] Storage Properties [a=1, b=2]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment