You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/13 03:30:07 UTC

[GitHub] [spark] LantaoJin commented on a change in pull request #27538: [SPARK-30785][SQL] Create table like should keep tracksPartitionsInCatalog same with source table

LantaoJin commented on a change in pull request #27538: [SPARK-30785][SQL] Create table like should keep tracksPartitionsInCatalog same with source table
URL: https://github.com/apache/spark/pull/27538#discussion_r378634569
 
 

 ##########
 File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
 ##########
 @@ -2724,4 +2730,18 @@ class HiveDDLSuite
       }
     }
   }
+
+  test("SPARK-30785: create table like a partitioned table") {
+    val catalog = spark.sessionState.catalog
+    withTable("sc_part", "ta_part") {
+      sql("CREATE TABLE sc_part (key string, ts int) USING parquet PARTITIONED BY (ts)")
+      sql("CREATE TABLE ta_part like sc_part")
+      val sourceTable = catalog.getTableMetadata(TableIdentifier("sc_part", Some("default")))
+      val targetTable = catalog.getTableMetadata(TableIdentifier("ta_part", Some("default")))
+      assert(sourceTable.tracksPartitionsInCatalog)
+      assert(sourceTable.tracksPartitionsInCatalog == targetTable.tracksPartitionsInCatalog)
+      assert(targetTable.partitionColumnNames == Seq("ts"))
+      sql("ALTER TABLE ta_part ADD PARTITION (ts=10)") // no exception
+    }
 
 Review comment:
   Sure. I think you mean `SHOW PARTITIONS ta_part`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org