ulysses-you commented on a change in pull request #28647:
URL: https://github.com/apache/spark/pull/28647#discussion_r432208324



##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
##########
@@ -2720,4 +2708,23 @@ 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("CREATE TABLE t1(c1 int) TBLPROPERTIES('k1'='v1', 'k2'='v2')")
+      val t1 = catalog.getTableMetadata(TableIdentifier("t1"))
+      assert(t1.properties("k1") == "v1")
+      assert(t1.properties("k2") == "v2")
+      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")
+      sql("CREATE TABLE t3 LIKE t1")
+      val t3 = catalog.getTableMetadata(TableIdentifier("t3"))
+      assert(t3.properties("k1") == "v1")
+      assert(t3.properties("k2") == "v2")

Review comment:
       Sure.




----------------------------------------------------------------
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

Reply via email to