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/06/10 21:39:27 UTC

[GitHub] [spark] yeshengm commented on a change in pull request #24749: [SPARK-27890][SQL] Improve SQL parser error message for character-only identifier with hyphens except those in expressions

yeshengm commented on a change in pull request #24749: [SPARK-27890][SQL] Improve SQL parser error message for character-only identifier with hyphens except those in expressions
URL: https://github.com/apache/spark/pull/24749#discussion_r292202783
 
 

 ##########
 File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ErrorParserSuite.scala
 ##########
 @@ -63,4 +72,88 @@ class ErrorParserSuite extends SparkFunSuite {
       "Combination of ORDER BY/SORT BY/DISTRIBUTE BY/CLUSTER BY is not supported",
       "^^^")
   }
+
+  test("hyphen in identifier - DDL tests") {
+    val msg = "unquoted identifier"
+    // ddl tests
+    intercept("USE test-test", 1, 8, 9, msg + " test-test")
+    intercept("CREATE DATABASE IF NOT EXISTS my-database", 1, 32, 33, "my-database")
+    intercept("DROP DATABASE my-database", 1, 16, 17, "my-database")
+    intercept(
+      """
+        |ALTER DATABASE my-database
+        |SET DBPROPERTIES ('p1'='v1')""".stripMargin, 2, 17, 18, "my-database")
+    intercept("CREATE TABLE test (attri-bute INT)", 1, 24, 25, msg + " attri-bute")
+    intercept(
+      """
+        |CREATE TABLE IF NOT EXISTS mydb.page-view
+        |USING parquet
+        |COMMENT 'This is the staging page view table'
+        |LOCATION '/user/external/page_view'
+        |TBLPROPERTIES ('p1'='v1', 'p2'='v2')
+        |AS SELECT * FROM src""".stripMargin, 2, 36, 37, msg + " page-view")
+    intercept("ANALYZE TABLE test-table PARTITION (part1)", 1, 18, 19, msg + " test-table")
+    intercept("ANALYZE TABLE test PARTITION (part-i)", 1, 34, 35, msg + " part-i")
+    intercept("DROP FUNCTION my-func IF EXISTS", 1, 16, 17, " my-func")
 
 Review comment:
   Nope. This PR doesn't support hyphen-ed identifiers in expressions, whereas here the function name is in a declaration.

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