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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -1337,7 +1337,7 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
 
   def duplicateMapKeyFoundError(key: Any): SparkRuntimeException = {
     new SparkRuntimeException(
-      errorClass = "_LEGACY_ERROR_TEMP_2127",
+      errorClass = "DUPLICATED_MAP_KEY",

Review Comment:
   As you are here, please, change the quoting of config value to:
   ```scala
   "lastWin" -> toSQLConfVal(SQLConf.MapKeyDedupPolicy.LAST_WIN.toString())))
   ```



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -482,6 +482,12 @@
     ],
     "sqlState" : "22012"
   },
+  "DUPLICATED_MAP_KEY" : {
+    "message" : [
+      "Duplicate map key <key> was found, please check the input data. If you 
want to remove the duplicated keys, you can set <mapKeyDedupPolicy> to 
<lastWin> so that the key inserted at last takes precedence."

Review Comment:
   Let's inline the config value `LAST_WIN` as we do for boolean configs, for 
instance:
   ```suggestion
         "Duplicate map key <key> was found, please check the input data. If 
you want to remove the duplicated keys, you can set <mapKeyDedupPolicy> to 
\"LAST_WIN\" so that the key inserted at last takes precedence."
   ```
   or there is a reason to pass it from the code?



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