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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/higherOrderFunctions.scala:
##########
@@ -72,16 +72,18 @@ object ResolveLambdaVariables extends Rule[LogicalPlan] {
     case LambdaFunction(function, names, _) =>
       if (names.size != argInfo.size) {
         e.failAnalysis(
-          errorClass = "_LEGACY_ERROR_TEMP_2300",
+          errorClass = "INVALID_LAMBDA_FUNCTION_CALL.NUM_ARGS_MISMATCH",
           messageParameters = Map(
-            "namesSize" -> names.size.toString,
-            "argInfoSize" -> argInfo.size.toString))
+            "expectedNumArgs" -> names.size.toString,
+            "actualNumArgs" -> argInfo.size.toString))
       }
 
       if (names.map(a => canonicalizer(a.name)).distinct.size < names.size) {
         e.failAnalysis(
-          errorClass = "_LEGACY_ERROR_TEMP_2301",
-          messageParameters = Map.empty)
+          errorClass = "INVALID_LAMBDA_FUNCTION_CALL.DUPLICATE_ARG_NAMES",
+          messageParameters = Map(
+            "args" -> names.map(a => canonicalizer(a.name)).mkString(", "),

Review Comment:
   Is `name` an id? If so, wrap it by `toSQLId`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/higherOrderFunctions.scala:
##########
@@ -72,16 +72,18 @@ object ResolveLambdaVariables extends Rule[LogicalPlan] {
     case LambdaFunction(function, names, _) =>
       if (names.size != argInfo.size) {
         e.failAnalysis(
-          errorClass = "_LEGACY_ERROR_TEMP_2300",
+          errorClass = "INVALID_LAMBDA_FUNCTION_CALL.NUM_ARGS_MISMATCH",
           messageParameters = Map(
-            "namesSize" -> names.size.toString,
-            "argInfoSize" -> argInfo.size.toString))
+            "expectedNumArgs" -> names.size.toString,
+            "actualNumArgs" -> argInfo.size.toString))
       }
 
       if (names.map(a => canonicalizer(a.name)).distinct.size < names.size) {
         e.failAnalysis(
-          errorClass = "_LEGACY_ERROR_TEMP_2301",
-          messageParameters = Map.empty)
+          errorClass = "INVALID_LAMBDA_FUNCTION_CALL.DUPLICATE_ARG_NAMES",
+          messageParameters = Map(
+            "args" -> names.map(a => canonicalizer(a.name)).mkString(", "),
+            "caseSensitiveConfig" -> "spark.sql.caseSensitive"))

Review Comment:
   Could you wrap the SQL config by `toSQLConf` like:
   ```suggestion
               "caseSensitiveConfig" -> toSQLConf(SQLConf.CASE_SENSITIVE.key)))
   ```



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