maropu commented on a change in pull request #29982:
URL: https://github.com/apache/spark/pull/29982#discussion_r551076912



##########
File path: 
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/CliSuite.scala
##########
@@ -573,4 +573,37 @@ class CliSuite extends SparkFunSuite with 
BeforeAndAfterAll with Logging {
     // the date formatter for `java.sql.LocalDate` must output negative years 
with sign.
     runCliWithin(1.minute)("SELECT MAKE_DATE(-44, 3, 15);" -> "-0044-03-15")
   }
+
+  test("SPARK-33100: Ignore a semicolon inside a bracketed comment in 
spark-sql") {
+    runCliWithin(1.minute)("/* SELECT 'test';*/ SELECT 'test';" -> "test")
+    runCliWithin(1.minute)(";;/* SELECT 'test';*/ SELECT 'test';" -> "test")
+    runCliWithin(1.minute)("/* SELECT 'test';*/;; SELECT 'test';" -> "test")
+    runCliWithin(1.minute)("SELECT 'test'; -- SELECT 'test';" -> "")
+    runCliWithin(1.minute)("SELECT 'test'; /* SELECT 'test';*/" -> "")
+    runCliWithin(1.minute)("/*$meta chars{^\\;}*/ SELECT 'test';" -> "test")
+    runCliWithin(1.minute)("/*\nmulti-line\n*/ SELECT 'test';" -> "test")
+    runCliWithin(1.minute)("/*/* multi-level bracketed*/ SELECT 'test';" -> 
"test")
+
+    val testHintTablePath = Utils.createTempDir()
+
+    runCliWithin(3.minute)(
+      "CREATE TEMPORARY VIEW t1 AS SELECT * FROM VALUES(1, 2), (2, 3), (3, 4), 
(4, 5), (5, 6)" +
+        " as t1(key, val);"
+        -> "",
+      s"""CREATE TABLE testHint(key int, val int) USING hive

Review comment:
       I meant, "could you avoid creating a catalog table for this test?" 
https://github.com/apache/spark/pull/29982#discussion_r550202290
   We cannot add a test like this?
   ```
   EXPLAIN EXTENDED SELECT /*+ broadcast(t1) */ * from t1
   // Then, check if an explain result has `ResolvedHint (strategy=broadcast)`
   == Analyzed Logical Plan ==
   k: int, v: int
   Project [k#0, v#1]
   +- ResolvedHint (strategy=broadcast)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      +- SubqueryAlias t1
         +- Project [k#0, v#1]
            +- SubqueryAlias t1
               +- LocalRelation [k#0, v#1]
   ```




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