MaxGekk commented on code in PR #36224:
URL: https://github.com/apache/spark/pull/36224#discussion_r852297076


##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala:
##########
@@ -472,4 +472,151 @@ class QueryParsingErrorsSuite extends QueryTest with 
SharedSparkSession {
            |^^^
            |""".stripMargin)
   }
+
+  test("PARSE_SYNTAX_ERROR: no viable input") {
+    val sqlText = "select ((r + 1) "
+    validateParsingError(
+      sqlText = sqlText,
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near end of input(line 1, pos 16)
+           |
+           |== SQL ==
+           |$sqlText
+           |----------------^^^
+           |""".stripMargin)

Review Comment:
   2 spaces:
   ```suggestion
           s"""
             |Syntax error at or near end of input(line 1, pos 16)
             |
             |== SQL ==
             |$sqlText
             |----------------^^^
             |""".stripMargin)
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala:
##########
@@ -472,4 +472,151 @@ class QueryParsingErrorsSuite extends QueryTest with 
SharedSparkSession {
            |^^^
            |""".stripMargin)
   }
+
+  test("PARSE_SYNTAX_ERROR: no viable input") {
+    val sqlText = "select ((r + 1) "
+    validateParsingError(
+      sqlText = sqlText,
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near end of input(line 1, pos 16)
+           |
+           |== SQL ==
+           |$sqlText
+           |----------------^^^
+           |""".stripMargin)
+  }
+
+  test("PARSE_SYNTAX_ERROR: extraneous input") {
+    validateParsingError(
+      sqlText = "select 1 1",
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near '1': extra input '1'(line 1, pos 9)
+           |
+           |== SQL ==
+           |select 1 1
+           |---------^^^
+           |""".stripMargin)
+
+    validateParsingError(
+      sqlText = "select *\nfrom r as q t",
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near 't': extra input 't'(line 2, pos 12)
+           |
+           |== SQL ==
+           |select *
+           |from r as q t
+           |------------^^^
+           |""".stripMargin)

Review Comment:
   2 spaces:
   ```suggestion
           s"""
             |Syntax error at or near 't': extra input 't'(line 2, pos 12)
             |
             |== SQL ==
             |select *
             |from r as q t
             |------------^^^
             |""".stripMargin)
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala:
##########
@@ -472,4 +472,151 @@ class QueryParsingErrorsSuite extends QueryTest with 
SharedSparkSession {
            |^^^
            |""".stripMargin)
   }
+
+  test("PARSE_SYNTAX_ERROR: no viable input") {
+    val sqlText = "select ((r + 1) "
+    validateParsingError(
+      sqlText = sqlText,
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near end of input(line 1, pos 16)
+           |
+           |== SQL ==
+           |$sqlText
+           |----------------^^^
+           |""".stripMargin)
+  }
+
+  test("PARSE_SYNTAX_ERROR: extraneous input") {
+    validateParsingError(
+      sqlText = "select 1 1",
+      errorClass = "PARSE_SYNTAX_ERROR",
+      sqlState = "42000",
+      message =
+        s"""
+           |Syntax error at or near '1': extra input '1'(line 1, pos 9)
+           |
+           |== SQL ==
+           |select 1 1
+           |---------^^^
+           |""".stripMargin)

Review Comment:
   Should be 2 spaces:
   ```suggestion
           s"""
             |Syntax error at or near '1': extra input '1'(line 1, pos 9)
             |
             |== SQL ==
             |select 1 1
             |---------^^^
             |""".stripMargin)
   ```



-- 
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: [email protected]

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