Skip to content

Commit

Permalink
[SPARK-21112][SQL] ALTER TABLE SET TBLPROPERTIES should not overwrite…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
gatorsmile authored and cloud-fan committed Jun 16, 2017
1 parent a18d637 commit 5d35d5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -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))
catalog.alterTable(newTable)
Seq.empty[Row]
}
Expand Down
Expand Up @@ -127,6 +127,7 @@ Provider parquet
Num Buckets 2
Bucket Columns [`a`]
Sort Columns [`b`]
Comment table_comment
Table Properties [e=3]
Location [not included in comparison]sql/core/spark-warehouse/t
Storage Properties [a=1, b=2]
Expand Down Expand Up @@ -157,6 +158,7 @@ Provider parquet
Num Buckets 2
Bucket Columns [`a`]
Sort Columns [`b`]
Comment table_comment
Table Properties [e=3]
Location [not included in comparison]sql/core/spark-warehouse/t
Storage Properties [a=1, b=2]
Expand Down

0 comments on commit 5d35d5c

Please sign in to comment.