Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Test ThriftServerQueryTestSuite asynchronously
  • Loading branch information
wangyum committed Oct 19, 2019
commit b3a26e15ba1851669ffe5bf28e5bcb6f84a18316
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.spark.sql.hive.thriftserver

import java.io.File
import java.sql.{DriverManager, Statement, Timestamp}
import java.sql.{DriverManager, SQLException, Statement, Timestamp}
import java.util.{Locale, MissingFormatArgumentException}

import scala.util.{Random, Try}
Expand Down Expand Up @@ -78,7 +78,7 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
override def sparkConf: SparkConf = super.sparkConf
// Hive Thrift server should not executes SQL queries in an asynchronous way
// because we may set session configuration.
.set(HiveUtils.HIVE_THRIFT_SERVER_ASYNC, false)
.set(HiveUtils.HIVE_THRIFT_SERVER_ASYNC, true)

override val isTestWithConfigSets = false

Expand Down Expand Up @@ -220,6 +220,12 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
s"Exception did not match for query #$i\n${expected.sql}, " +
s"expected: ${expected.output}, but got: ${output.output}")

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

case _ =>
assertResult(expected.output, s"Result did not match for query #$i\n${expected.sql}") {
output.output
Expand Down