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/04/20 05:47:42 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #36259: [SPARK-38949][SQL] Wrap SQL statements by double quotes in error messages

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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -416,13 +437,20 @@ object QueryParsingErrors extends QueryErrorsBase {
   }
 
   def createFuncWithBothIfNotExistsAndReplaceError(ctx: CreateFunctionContext): Throwable = {
-    new ParseException("INVALID_SQL_SYNTAX",
-      Array("CREATE FUNCTION with both IF NOT EXISTS and REPLACE is not allowed."), ctx)
+    new ParseException(
+      errorClass = "INVALID_SQL_SYNTAX",
+      messageParameters = Array(
+        s"${toSQLStmt("CREATE FUNCTION")} with both ${toSQLStmt("IF NOT EXISTS")} " +
+        s"and ${toSQLStmt("REPLACE")} is not allowed."),
+      ctx)
   }
 
   def defineTempFuncWithIfNotExistsError(ctx: CreateFunctionContext): Throwable = {
-    new ParseException("INVALID_SQL_SYNTAX",
-      Array("It is not allowed to define a TEMPORARY function with IF NOT EXISTS."), ctx)
+    new ParseException(
+      errorClass = "INVALID_SQL_SYNTAX",
+      messageParameters = Array(
+        s"It is not allowed to define a ${toSQLStmt("TEMPORARY")} function" +

Review Comment:
   makes sense. Let's do that.



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