jiangxb1987 commented on a change in pull request #24807: [SPARK-27958][SQL]
Stopping a SparkSession should not always stop Spark Context
URL: https://github.com/apache/spark/pull/24807#discussion_r295576914
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -711,12 +711,15 @@ class SparkSession private(
// scalastyle:on
/**
- * Stop the underlying `SparkContext`.
+ * Stop the underlying `SparkContext` if there are no active sessions
remaining.
*
* @since 2.0.0
*/
def stop(): Unit = {
- sparkContext.stop()
+ SparkSession.clearActiveSession()
Review comment:
The problem is now we update both `activeSession` and `defaultSession` when
we create a new SparkSession. If we don't clear the defaultSession here then we
will still have defaultSession returned every time we call `getOrCreate()`.
Whether to keep the notion of default session worth another mail thread or PR,
and the quickest way to make this PR goes in would be to clear the
defaultSession here, IIUC.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]