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 2022/10/24 02:50:02 UTC

[GitHub] [spark] panbingkun opened a new pull request, #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

panbingkun opened a new pull request, #38364:
URL: https://github.com/apache/spark/pull/38364

   ### What changes were proposed in this pull request?
   his PR aims to replace 'intercept' with 'Check error classes' in TableIdentifierParserSuite.
   
   ### Why are the changes needed?
   The changes improve the error framework.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   By running the modified test suite:
   ```
   $ build/sbt "test:testOnly *TableIdentifierParserSuite"
   ```


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


[GitHub] [spark] MaxGekk commented on pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #38364:
URL: https://github.com/apache/spark/pull/38364#issuecomment-1288783248

   +1, LGTM. Merging to master.
   Thank you, @panbingkun.


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


[GitHub] [spark] MaxGekk commented on pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #38364:
URL: https://github.com/apache/spark/pull/38364#issuecomment-1288558404

   Waiting for CI.


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


[GitHub] [spark] MaxGekk commented on a diff in pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #38364:
URL: https://github.com/apache/spark/pull/38364#discussion_r1002902138


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala:
##########
@@ -290,9 +290,35 @@ class TableIdentifierParserSuite extends SQLKeywordUtils {
     assert(TableIdentifier("q", Option("d")) === parseTableIdentifier("d.q"))
 
     // Illegal names.
-    Seq("", "d.q.g", "t:", "${some.var.x}", "tab:1").foreach { identifier =>
-      intercept[ParseException](parseTableIdentifier(identifier))
-    }
+    val identifier1 = ""
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier1)),
+      errorClass = "PARSE_EMPTY_STATEMENT",
+      parameters = Map.empty)
+
+    val identifier2 = "d.q.g"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier2)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "'.'", "hint" -> ""))
+
+    val identifier3 = "t:"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier3)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "':'", "hint" -> ": extra input ':'"))
+
+    val identifier4 = "${some.var.x}"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier4)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "'$'", "hint" -> ""))
+
+    val identifier5 = "tab:1"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier5)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "':'", "hint" -> ""))

Review Comment:
   Could you avoid boilerplate code like
   ```suggestion
       Seq(
         "" -> Map.empty[String, String],
         "d.q.g" -> Map("error" -> "'.'", "hint" -> ""),
         "t:" -> Map("error" -> "':'", "hint" -> ": extra input ':'"),
         "${some.var.x}" -> Map("error" -> "'$'", "hint" -> ""),
         "tab:1" -> Map("error" -> "':'", "hint" -> "")
       ).foreach { case (identifier, parameters) =>
         checkError(
           exception = intercept[ParseException](parseTableIdentifier(identifier)),
           errorClass = "PARSE_EMPTY_STATEMENT",
           parameters = parameters)
       }
   ```



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


[GitHub] [spark] panbingkun commented on a diff in pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
panbingkun commented on code in PR #38364:
URL: https://github.com/apache/spark/pull/38364#discussion_r1002912295


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala:
##########
@@ -290,9 +290,35 @@ class TableIdentifierParserSuite extends SQLKeywordUtils {
     assert(TableIdentifier("q", Option("d")) === parseTableIdentifier("d.q"))
 
     // Illegal names.
-    Seq("", "d.q.g", "t:", "${some.var.x}", "tab:1").foreach { identifier =>
-      intercept[ParseException](parseTableIdentifier(identifier))
-    }
+    val identifier1 = ""
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier1)),
+      errorClass = "PARSE_EMPTY_STATEMENT",
+      parameters = Map.empty)
+
+    val identifier2 = "d.q.g"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier2)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "'.'", "hint" -> ""))
+
+    val identifier3 = "t:"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier3)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "':'", "hint" -> ": extra input ':'"))
+
+    val identifier4 = "${some.var.x}"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier4)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "'$'", "hint" -> ""))
+
+    val identifier5 = "tab:1"
+    checkError(
+      exception = intercept[ParseException](parseTableIdentifier(identifier5)),
+      errorClass = "PARSE_SYNTAX_ERROR",
+      parameters = Map("error" -> "':'", "hint" -> ""))

Review Comment:
   Done



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


[GitHub] [spark] AmplabJenkins commented on pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38364:
URL: https://github.com/apache/spark/pull/38364#issuecomment-1288620077

   Can one of the admins verify this patch?


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


[GitHub] [spark] MaxGekk closed pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite

Posted by GitBox <gi...@apache.org>.
MaxGekk closed pull request #38364: [SPARK-40891][SQL][TESTS] Check error classes in TableIdentifierParserSuite
URL: https://github.com/apache/spark/pull/38364


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