From 994dc6ce849f4502e2a9060cc4e5246967eb03d3 Mon Sep 17 00:00:00 2001 From: Fu Chen Date: Tue, 28 Jun 2022 09:11:06 +0800 Subject: [PATCH] [KYUUBI #2949] Flaky test: execute statement - analysis exception ### _Why are the changes needed?_ to close #2949 Unquoted the function name in the error `SECOND_FUNCTION_ARGUMENT_NOT_INTEGER` since Spark-3.4.0, for more details, see https://github.com/apache/spark/pull/36693 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2950 from cfmcgrady/kyuubi-2949. Closes #2949 4d4da0ba [Fu Chen] fix Authored-by: Fu Chen Signed-off-by: ulysses-you --- .../org/apache/kyuubi/operation/SparkQueryTests.scala | 7 +++++-- .../apache/kyuubi/server/mysql/MySQLSparkQuerySuite.scala | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala index 654d4afad..dde47c771 100644 --- a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala +++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala @@ -323,13 +323,16 @@ trait SparkQueryTests extends HiveJDBCTestHelper { test("execute statement - analysis exception") { val sql = "select date_sub(date'2011-11-11', '1.2')" + val errors = Set( + "The second argument of 'date_sub' function needs to be an integer.", + // unquoted since Spark-3.4, see https://github.com/apache/spark/pull/36693 + "The second argument of date_sub function needs to be an integer.") withJdbcStatement() { statement => val e = intercept[SQLException] { statement.executeQuery(sql) } - assert(e.getMessage - .contains("The second argument of 'date_sub' function needs to be an integer.")) + assert(errors.exists(msg => e.getMessage.contains(msg))) } } diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/mysql/MySQLSparkQuerySuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/mysql/MySQLSparkQuerySuite.scala index 272619cb9..393f3a8ea 100644 --- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/mysql/MySQLSparkQuerySuite.scala +++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/mysql/MySQLSparkQuerySuite.scala @@ -249,13 +249,16 @@ class MySQLSparkQuerySuite extends WithKyuubiServer with MySQLJDBCTestHelper { test("execute statement - analysis exception") { val sql = "select date_sub(date'2011-11-11', '1.2')" + val errors = Set( + "The second argument of 'date_sub' function needs to be an integer.", + // unquoted since Spark-3.4, see https://github.com/apache/spark/pull/36693 + "The second argument of date_sub function needs to be an integer.") withJdbcStatement() { statement => val e = intercept[SQLException] { statement.executeQuery(sql) } - assert(e.getMessage - .contains("The second argument of 'date_sub' function needs to be an integer.")) + assert(errors.exists(msg => e.getMessage.contains(msg))) } }