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


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -2578,6 +2578,13 @@
     },
     "sqlState" : "42K0K"
   },
+  "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME" : {
+    "message" : [
+      "`<fieldName>` is not a valid identifier of Java and cannot be used as 
field name",

Review Comment:
   ```suggestion
         "<fieldName> is not a valid identifier of Java and cannot be used as 
field name",
   ```



##########
sql/api/src/main/scala/org/apache/spark/sql/errors/ExecutionErrors.scala:
##########
@@ -195,7 +195,7 @@ private[sql] trait ExecutionErrors extends 
DataTypeErrorsBase {
       fieldName: String,
       walkedTypePath: WalkedTypePath): SparkUnsupportedOperationException = {
     new SparkUnsupportedOperationException(
-      errorClass = "_LEGACY_ERROR_TEMP_2140",
+      errorClass = "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME",
       messageParameters =
         Map("fieldName" -> fieldName, "walkedTypePath" -> 
walkedTypePath.toString))

Review Comment:
   I think we can consider `fieldName` as an id, and quote it by `toSQLId`



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -2578,6 +2578,13 @@
     },
     "sqlState" : "42K0K"
   },
+  "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME" : {
+    "message" : [
+      "`<fieldName>` is not a valid identifier of Java and cannot be used as 
field name",
+      "<walkedTypePath>."
+    ],
+    "sqlState" : "42601"

Review Comment:
   I wonder why you selected the error class `42` instead of:
   ```
       "46": "Java Error",
   ```



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