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


##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala:
##########
@@ -362,6 +362,19 @@ class QueryCompilationErrorsSuite extends QueryTest with 
SharedSparkSession {
       }
     }
   }
+
+  test("SECOND_FUNCTION_ARGUMENT_NOT_INTEGER: " +
+    "the second argument of 'date_add' function needs to be an integer") {
+    withSQLConf(SQLConf.ANSI_ENABLED.key -> "false") {
+      val e = intercept[AnalysisException] {
+        sql("select date_add('1982-08-15', 'x')").collect()
+      }
+      assert(e.getErrorClass === "SECOND_FUNCTION_ARGUMENT_NOT_INTEGER")
+      assert(e.getSqlState === "22023")
+      assert(e.getMessage ===
+        "The second argument of 'date_add' function needs to be an integer.")

Review Comment:
   Could you use the `checkErrorClass` method added by 
https://github.com/apache/spark/pull/36287. 



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