itholic commented on code in PR #39951:
URL: https://github.com/apache/spark/pull/39951#discussion_r1103728421


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -998,6 +998,12 @@
     },
     "sqlState" : "42K07"
   },
+  "INVALID_SET_SYNTAX" : {
+    "message" : [
+      "Expected format is 'SET', 'SET key', or 'SET key=value'. If you want to 
include special characters in key, or include semicolon in value, please use 
quotes, e.g., SET `key`=`value`."

Review Comment:
   Oh... actually it's not wrong example.
   
   We should backquotes for value when the value contains invalid syntax as 
below:
   ```scala
   scala> sql("SET a=`1;2;;`").show()
   +---+-----+
   |key|value|
   +---+-----+
   |  a|1;2;;|
   +---+-----+
   ```
   
   Otherwise it raises error:
   ```scala
   scala> sql("SET a=1;2;;")
   org.apache.spark.sql.catalyst.parser.ParseException:
   [INVALID_SET_SYNTAX] Expected format is 'SET', 'SET key', or 'SET 
key=value'. If you want to include special characters in key, or include 
semicolon in value, please use quotes, e.g., SET `key`=`value`.(line 1, pos 0)
   
   == SQL ==
   SET a=1;2;;
   ^^^
   ```



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