Skip to content

Commit 2a422ea

Browse files
committed
Enable SPARK-28527
1 parent 5e92301 commit 2a422ea

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

sql/core/src/test/scala/org/apache/spark/sql/test/SharedSparkSession.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ trait SharedSparkSessionBase
7272
// this rule may potentially block testing of other optimization rules such as
7373
// ConstantPropagation etc.
7474
.set(SQLConf.OPTIMIZER_EXCLUDED_RULES.key, ConvertToLocalRelation.ruleName)
75+
// Hive Thrift server should not executes SQL queries in an asynchronous way
76+
// because we may set session configuration.
77+
.set("spark.sql.hive.thriftServer.async", "false")
7578
conf.set(
7679
StaticSQLConf.WAREHOUSE_PATH,
7780
conf.get(StaticSQLConf.WAREHOUSE_PATH) + "/" + getClass.getCanonicalName)

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,7 @@ private[hive] class SparkExecuteStatementOperation(
276276
setState(OperationState.ERROR)
277277
HiveThriftServer2.listener.onStatementError(
278278
statementId, e.getMessage, SparkUtils.exceptionString(e))
279-
if (e.isInstanceOf[HiveSQLException]) {
280-
throw e.asInstanceOf[HiveSQLException]
281-
} else {
282-
throw new HiveSQLException("Error running query: " + e.toString, e)
283-
}
279+
e
284280
}
285281
} finally {
286282
synchronized {

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import scala.util.control.NonFatal
2626

2727
import org.apache.hadoop.hive.conf.HiveConf.ConfVars
2828
import org.apache.hive.service.cli.HiveSQLException
29-
import org.scalatest.Ignore
3029

3130
import org.apache.spark.sql.{AnalysisException, SQLQueryTestSuite}
3231
import org.apache.spark.sql.catalyst.util.fileToString
@@ -43,12 +42,12 @@ import org.apache.spark.sql.types._
4342
* 2. Support DESC command.
4443
* 3. Support SHOW command.
4544
*/
46-
@Ignore
4745
class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
4846

4947
private var hiveServer2: HiveThriftServer2 = _
5048

51-
override def beforeEach(): Unit = {
49+
override def beforeAll(): Unit = {
50+
super.beforeAll()
5251
// Chooses a random port between 10000 and 19999
5352
var listeningPort = 10000 + Random.nextInt(10000)
5453

@@ -65,8 +64,12 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite {
6564
logInfo("HiveThriftServer2 started successfully")
6665
}
6766

68-
override def afterEach(): Unit = {
69-
hiveServer2.stop()
67+
override def afterAll(): Unit = {
68+
try {
69+
hiveServer2.stop()
70+
} finally {
71+
super.afterAll()
72+
}
7073
}
7174

7275
override val isTestWithConfigSets = false

0 commit comments

Comments
 (0)