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


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -714,6 +714,11 @@
     ],
     "sqlState" : "22023"
   },
+  "INVALID_FUNCTION_ARGS" : {

Review Comment:
   How about to introduce sub-classes of `WRONG_NUM_ARGS`:
   - WITHOUT_SUGGESTION
   - WITH_SUGGESTION
   
   And declare in the common message template that
   ```
   Invalid number of arguments for the function <funcName>.
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala:
##########
@@ -638,10 +638,16 @@ class UDFSuite extends QueryTest with SharedSparkSession {
   }
 
   test("SPARK-28521 error message for CAST(parameter types contains 
DataType)") {

Review Comment:
   Let's move this test to `QueryCompilationsErrorsSuite`



##########
sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala:
##########
@@ -638,10 +638,16 @@ class UDFSuite extends QueryTest with SharedSparkSession {
   }
 
   test("SPARK-28521 error message for CAST(parameter types contains 
DataType)") {
-    val e = intercept[AnalysisException] {
-      spark.sql("SELECT CAST(1)")
-    }
-    assert(e.getMessage.contains("Invalid arguments for function cast"))
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql("SELECT CAST(1)")

Review Comment:
   The code above is not correct actually in some cases. One more example is 
`TimestampAdd`:
   
https://github.com/apache/spark/blob/a3a755d36136295473a4873a6df33c295c29213e/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala#L3156-L3159



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