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 2021/10/19 03:23:10 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #34317: [SPARK-37046][SQL]: Alter view does not preserve column case

cloud-fan commented on a change in pull request #34317:
URL: https://github.com/apache/spark/pull/34317#discussion_r731463426



##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
##########
@@ -3025,4 +3025,49 @@ class HiveDDLSuite
       assert(errMsg2.contains("Cannot use interval type in the table schema"))
     }
   }
+
+  test("SPARK-37046: Alter view should preserve column case with view definition change") {
+    withView("v") {
+      // Changing view definition should preserve column case
+      spark.sql("CREATE VIEW v AS SELECT 1 AS A, 1 AS B")
+      val df = spark.table("v")
+      assert("A".equals(df.schema.fields(0).name))
+      assert("B".equals(df.schema.fields(1).name))

Review comment:
       nit: `assert(df.schema.names == Seq("A", "B"))`

##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
##########
@@ -3025,4 +3025,49 @@ class HiveDDLSuite
       assert(errMsg2.contains("Cannot use interval type in the table schema"))
     }
   }
+
+  test("SPARK-37046: Alter view should preserve column case with view definition change") {
+    withView("v") {
+      // Changing view definition should preserve column case
+      spark.sql("CREATE VIEW v AS SELECT 1 AS A, 1 AS B")
+      val df = spark.table("v")
+      assert("A".equals(df.schema.fields(0).name))
+      assert("B".equals(df.schema.fields(1).name))

Review comment:
       same to other places




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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