Skip to content

Commit 3163b6b

Browse files
committed
[SPARK-29516][SQL][TEST] Test ThriftServerQueryTestSuite asynchronously
### What changes were proposed in this pull request? This PR test `ThriftServerQueryTestSuite` in an asynchronous way. ### Why are the changes needed? The default value of `spark.sql.hive.thriftServer.async` is `true`. ### Does this PR introduce any user-facing change? No ### How was this patch tested? ``` build/sbt "hive-thriftserver/test-only *.ThriftServerQueryTestSuite" -Phive-thriftserver build/mvn -Dtest=none -DwildcardSuites=org.apache.spark.sql.hive.thriftserver.ThriftServerQueryTestSuite test -Phive-thriftserver ``` Closes #26172 from wangyum/SPARK-29516. Authored-by: Yuming Wang <yumwang@ebay.com> Signed-off-by: Yuming Wang <wgyumg@gmail.com>
1 parent 868d851 commit 3163b6b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/ThriftServerQueryTestSuite.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package org.apache.spark.sql.hive.thriftserver
1919

2020
import java.io.File
21-
import java.sql.{DriverManager, Statement, Timestamp}
21+
import java.sql.{DriverManager, SQLException, Statement, Timestamp}
2222
import java.util.{Locale, MissingFormatArgumentException}
2323

2424
import scala.util.{Random, Try}
@@ -75,11 +75,6 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
7575
}
7676
}
7777

78-
override def sparkConf: SparkConf = super.sparkConf
79-
// Hive Thrift server should not executes SQL queries in an asynchronous way
80-
// because we may set session configuration.
81-
.set(HiveUtils.HIVE_THRIFT_SERVER_ASYNC, false)
82-
8378
override val isTestWithConfigSets = false
8479

8580
/** List of test cases to ignore, in lower cases. */
@@ -208,6 +203,12 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
208203
s"Exception did not match for query #$i\n${expected.sql}, " +
209204
s"expected: ${expected.output}, but got: ${output.output}")
210205

206+
// SQLException should not exactly match. We only assert the result contains Exception.
207+
case _ if output.output.startsWith(classOf[SQLException].getName) =>
208+
assert(expected.output.contains("Exception"),
209+
s"Exception did not match for query #$i\n${expected.sql}, " +
210+
s"expected: ${expected.output}, but got: ${output.output}")
211+
211212
case _ =>
212213
assertResult(expected.output, s"Result did not match for query #$i\n${expected.sql}") {
213214
output.output

0 commit comments

Comments
 (0)