wzhfy commented on a change in pull request #29761:
URL: https://github.com/apache/spark/pull/29761#discussion_r488748289



##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2242,6 +2242,29 @@ abstract class SQLQuerySuiteBase extends QueryTest with 
SQLTestUtils with TestHi
     }
   }
 
+  test("SPARK-32889 ORC table column name supports special characters like $ 
eg.") {
+    Seq("$").foreach { name =>
+      Seq("ORC").foreach { source =>

Review comment:
       This is only for ORC, so there's no need to have a loop here

##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2242,6 +2242,29 @@ abstract class SQLQuerySuiteBase extends QueryTest with 
SQLTestUtils with TestHi
     }
   }
 
+  test("SPARK-32889 ORC table column name supports special characters like $ 
eg.") {
+    Seq("$").foreach { name =>

Review comment:
       maybe add more special characters?

##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2242,6 +2242,29 @@ abstract class SQLQuerySuiteBase extends QueryTest with 
SQLTestUtils with TestHi
     }
   }
 
+  test("SPARK-32889 ORC table column name supports special characters like $ 
eg.") {
+    Seq("$").foreach { name =>
+      Seq("ORC").foreach { source =>
+        withSQLConf("spark.sql.orc.column.allowSpecialChar" -> "true") {
+          Seq(s"CREATE TABLE t32889(`col$name` INT) USING $source",
+              s"CREATE TABLE t32889 STORED AS $source AS SELECT 1 `col$name`",
+              s"CREATE TABLE t32889 USING $source AS SELECT 1 `col$name`",
+              s"CREATE TABLE t32889(`col$name` INT) USING hive OPTIONS 
(fileFormat '$source')")
+          .foreach { command =>
+            withTable("t32889") {
+              sql(command)
+            }
+          }
+
+          withTable("t32889") {
+            sql(s"CREATE TABLE t32889(`col` INT) USING $source")
+            sql(s"ALTER TABLE t32889 ADD COLUMNS(`col$name` INT)")

Review comment:
       Is `add columns` for testing different code path? Or can we ignore this 
line of test?

##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2242,6 +2242,29 @@ abstract class SQLQuerySuiteBase extends QueryTest with 
SQLTestUtils with TestHi
     }
   }
 
+  test("SPARK-32889 ORC table column name supports special characters like $ 
eg.") {
+    Seq("$").foreach { name =>
+      Seq("ORC").foreach { source =>
+        withSQLConf("spark.sql.orc.column.allowSpecialChar" -> "true") {
+          Seq(s"CREATE TABLE t32889(`col$name` INT) USING $source",
+              s"CREATE TABLE t32889 STORED AS $source AS SELECT 1 `col$name`",
+              s"CREATE TABLE t32889 USING $source AS SELECT 1 `col$name`",
+              s"CREATE TABLE t32889(`col$name` INT) USING hive OPTIONS 
(fileFormat '$source')")
+          .foreach { command =>
+            withTable("t32889") {

Review comment:
       could you extract the table name as a `val`, and give a more meaningful 
name?




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



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

Reply via email to