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 2019/12/03 12:57:29 UTC

[GitHub] [spark] Ngone51 commented on a change in pull request #26736: [SPARK-30098][SQL] Use default datasource as provider for CREATE TABLE syntax

Ngone51 commented on a change in pull request #26736: [SPARK-30098][SQL] Use default datasource as provider for CREATE TABLE syntax
URL: https://github.com/apache/spark/pull/26736#discussion_r353162143
 
 

 ##########
 File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveShowCreateTableSuite.scala
 ##########
 @@ -177,17 +178,24 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
   }
 
   test("SPARK-24911: keep quotes for nested fields in hive") {
-    withTable("t1") {
-      val createTable = "CREATE TABLE `t1`(`a` STRUCT<`b`: STRING>)"
-      sql(createTable)
-      val shownDDL = sql(s"SHOW CREATE TABLE t1")
-        .head()
-        .getString(0)
-        .split("\n")
-        .head
-      assert(shownDDL == createTable)
+    val originalCreateHiveTable = TestHive.conf.createHiveTableByDefaultEnabled
+    try {
+      TestHive.conf.setConf(SQLConf.LEGACY_CREATE_HIVE_TABLE_BY_DEFAULT_ENABLED, true)
+      withTable("t1") {
+        val createTable = "CREATE TABLE `t1`(`a` STRUCT<`b`: STRING>)"
+        sql(createTable)
+        val shownDDL = sql(s"SHOW CREATE TABLE t1")
+          .head()
+          .getString(0)
+          .split("\n")
+          .head
+        assert(shownDDL == createTable)
 
 Review comment:
   I still need to check this. This test only passed under legacy mode (match `#createHiveTable` rule). And even using `val createTable = "CREATE TABLE `t1`(`a` STRUCT<`b`: STRING>) USING hive"` under non legacy mode(match `#createTable` rule), it fails due to a single whitespace difference: 
   
   ```
   org.scalatest.exceptions.TestFailedException: "CREATE TABLE `t1`[ ](`a` STRUCT<`b`: STR..." did not equal "CREATE TABLE `t1`[](`a` STRUCT<`b`: STR..."
   ```
   
   If this really only pass under legacy mode, I think this should also be a behavior change needs to be mentioned somewhere.

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