This is an automated email from the ASF dual-hosted git repository. maxgekk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new ef94090de83 [SPARK-38750][SQL][TESTS] Test the error class: SECOND_FUNCTION_ARGUMENT_NOT_INTEGER ef94090de83 is described below commit ef94090de83acae6cdabce5e45c84e012200c531 Author: panbingkun <pbk1...@gmail.com> AuthorDate: Sat Apr 23 09:11:45 2022 +0300 [SPARK-38750][SQL][TESTS] Test the error class: SECOND_FUNCTION_ARGUMENT_NOT_INTEGER ## What changes were proposed in this pull request? This PR aims to add a test for the error class SECOND_FUNCTION_ARGUMENT_NOT_INTEGER to `QueryCompilationErrorsSuite`. ### Why are the changes needed? The changes improve test coverage, and document expected error messages in tests. ### Does this PR introduce any user-facing change? No ### How was this patch tested? By running new test: ``` $ build/sbt "sql/testOnly *QueryCompilationErrorsSuite*" ``` Closes #36284 from panbingkun/SPARK-38750. Authored-by: panbingkun <pbk1...@gmail.com> Signed-off-by: Max Gekk <max.g...@gmail.com> --- .../spark/sql/errors/QueryCompilationErrorsSuite.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala index 862255b7d12..23e512993c4 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala @@ -380,6 +380,19 @@ class QueryCompilationErrorsSuite } } } + + test("SECOND_FUNCTION_ARGUMENT_NOT_INTEGER: " + + "the second argument of 'date_add' function needs to be an integer") { + withSQLConf(SQLConf.ANSI_ENABLED.key -> "false") { + checkErrorClass( + exception = intercept[AnalysisException] { + sql("select date_add('1982-08-15', 'x')").collect() + }, + errorClass = "SECOND_FUNCTION_ARGUMENT_NOT_INTEGER", + msg = "The second argument of 'date_add' function needs to be an integer.", + sqlState = Some("22023")) + } + } } class MyCastToString extends SparkUserDefinedFunction( --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org