cloud-fan commented on a change in pull request #28868:
URL: https://github.com/apache/spark/pull/28868#discussion_r448976202
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
##########
@@ -257,4 +257,25 @@ class SparkSessionBuilderSuite extends SparkFunSuite with
BeforeAndAfterEach {
context.stop()
}
}
+
+ test("SPARK-32029: check active session if spark context is stop") {
+ val conf = new SparkConf()
+ .setMaster("local")
+ .setAppName("test-SPARK-32029")
+ val context = new SparkContext(conf)
+ val session = SparkSession
+ .builder()
+ .sparkContext(context)
+ .getOrCreate()
+
+ context.stop()
+ val msg = intercept[IllegalStateException] {
+ session.withActive()
+ }.getMessage
+ assert(msg.contains("Cannot call methods on a stopped SparkContext."))
+ val msg2 = intercept[IllegalStateException] {
+ SparkSession.getActiveSession
Review comment:
what's the behavior before this PR? is the session still use-able?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]