maropu commented on a change in pull request #28647: URL: https://github.com/apache/spark/pull/28647#discussion_r432794003
########## File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala ########## @@ -2720,4 +2704,26 @@ class HiveDDLSuite checkAnswer(sql("SHOW PARTITIONS ta_part"), Row("ts=10") :: Nil) } } + + test("SPARK-31828: Retain table properties at CreateTableLikeCommand") { + val catalog = spark.sessionState.catalog + withTable("t1", "t2", "t3") { + sql(s"CREATE TABLE t1(c1 int) TBLPROPERTIES('k1'='v1', 'k2'='v2', 'totalNumberFiles'='meta')") + val t1 = catalog.getTableMetadata(TableIdentifier("t1")) + assert(t1.properties("k1") == "v1") + assert(t1.properties("k2") == "v2") + assert(t1.properties(s"totalNumberFiles") == "meta") + sql("CREATE TABLE t2 LIKE t1 TBLPROPERTIES('k2'='v3', 'k4'='v4')") + val t2 = catalog.getTableMetadata(TableIdentifier("t2")) + assert(t2.properties("k1") == "v1") + assert(t2.properties("k2") == "v3") + assert(t2.properties("k4") == "v4") + assert(t2.properties.get(s"totalNumberFiles").isEmpty) + sql("CREATE TABLE t3 LIKE t1") + val t3 = catalog.getTableMetadata(TableIdentifier("t3")) + assert(t3.properties("k1") == "v1") + assert(t3.properties("k2") == "v2") + assert(t3.properties.get(s"totalNumberFiles").isEmpty) Review comment: nit: remove `s` in the head. It seems there are the same unnecessary `s` in the other places, too. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org