dongjoon-hyun commented on a change in pull request #27107: [SPARK-30436][SQL] 
Allow CREATE EXTERNAL TABLE with only requiring LOCATION
URL: https://github.com/apache/spark/pull/27107#discussion_r363584533
 
 

 ##########
 File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
 ##########
 @@ -659,6 +659,34 @@ class HiveDDLSuite
       "partition column value"))
   }
 
+  test("create external table with default") {
+    val catalog = spark.sessionState.catalog
+    withTempDir { tmpDir =>
+      val externalTab = "extTable_with_defaults"
+      withTable(externalTab) {
+        assert(tmpDir.listFiles.isEmpty)
+        sql(
+          s"""
+             |CREATE EXTERNAL TABLE $externalTab (key INT, value STRING)
+             |LOCATION '${tmpDir.toURI}'
+          """.stripMargin)
+
+        val hiveTable = catalog.getTableMetadata(TableIdentifier(externalTab, 
Some("default")))
+        assert(hiveTable.tableType == CatalogTableType.EXTERNAL)
+
+        // Before data insertion, all the directory are empty
+        assert(tmpDir.listFiles == null || tmpDir.listFiles.isEmpty)
+
+        sql(s"INSERT INTO $externalTab VALUES (1, 'a')")
+        assert(tmpDir.listFiles.nonEmpty)
+
+        sql(s"DROP TABLE $externalTab")
+        // After data insertion, all the directory are not empty
+        assert(tmpDir.listFiles.nonEmpty)
 
 Review comment:
   Line 676 ~ 685 is a duplication with `test("drop external tables in default 
database")`. Shall we focus on `create external table with default` by removing 
line 676 ~ 685? It will minimize the test time while providing the same test 
coverage.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to