Skip to content

Commit ed18ee7

Browse files
committed
Reflect review comment
1 parent 13a58c6 commit ed18ee7

File tree

3 files changed

+25
-56
lines changed

3 files changed

+25
-56
lines changed

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

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@
1717

1818
package org.apache.spark.sql.hive.thriftserver
1919

20-
import test.custom.listener.{DummyQueryExecutionListener, DummyStreamingQueryListener}
21-
2220
import org.apache.spark.SparkFunSuite
2321
import org.apache.spark.launcher.SparkLauncher
2422
import org.apache.spark.sql.hive.HiveUtils.{HIVE_METASTORE_JARS, HIVE_METASTORE_VERSION}
2523
import org.apache.spark.sql.hive.test.TestHiveContext
24+
import org.apache.spark.sql.hive.thriftserver.__root__.test.custom.listener.{DummyQueryExecutionListener, DummyStreamingQueryListener}
2625
import org.apache.spark.sql.internal.StaticSQLConf.{QUERY_EXECUTION_LISTENERS, STREAMING_QUERY_LISTENERS, WAREHOUSE_PATH}
2726

2827
class SparkSQLEnvSuite extends SparkFunSuite {
2928
test("SPARK-29604 external listeners should be initialized with Spark classloader") {
3029
withSystemProperties(
31-
// Intentionally place listeners to the out of spark package, because IsolatedClientLoader
32-
// leverages Spark classloader for shared classess including spark package.
3330
QUERY_EXECUTION_LISTENERS.key -> classOf[DummyQueryExecutionListener].getCanonicalName,
3431
STREAMING_QUERY_LISTENERS.key -> classOf[DummyStreamingQueryListener].getCanonicalName,
3532
WAREHOUSE_PATH.key -> TestHiveContext.makeWarehouseDir().toURI.getPath,
@@ -68,3 +65,27 @@ class SparkSQLEnvSuite extends SparkFunSuite {
6865
}
6966
}
7067
}
68+
69+
/**
70+
* These classes in this package are intentionally placed to the outer package of spark,
71+
* because IsolatedClientLoader leverages Spark classloader for shared classess including
72+
* spark package, and the test should fail if Spark initializes these listeners with
73+
* IsolatedClientLoader.
74+
*/
75+
package __root__.test.custom.listener {
76+
77+
import org.apache.spark.sql.execution.QueryExecution
78+
import org.apache.spark.sql.streaming.StreamingQueryListener
79+
import org.apache.spark.sql.util.QueryExecutionListener
80+
81+
class DummyQueryExecutionListener extends QueryExecutionListener {
82+
override def onSuccess(funcName: String, qe: QueryExecution, durationNs: Long): Unit = {}
83+
override def onFailure(funcName: String, qe: QueryExecution, error: Throwable): Unit = {}
84+
}
85+
86+
class DummyStreamingQueryListener extends StreamingQueryListener {
87+
override def onQueryStarted(event: StreamingQueryListener.QueryStartedEvent): Unit = {}
88+
override def onQueryProgress(event: StreamingQueryListener.QueryProgressEvent): Unit = {}
89+
override def onQueryTerminated(event: StreamingQueryListener.QueryTerminatedEvent): Unit = {}
90+
}
91+
}

sql/hive-thriftserver/src/test/scala/test/custom/listener/DummyQueryExecutionListener.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.

sql/hive-thriftserver/src/test/scala/test/custom/listener/DummyStreamingQueryListener.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)