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_r294564471
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -776,6 +779,8 @@ class SparkSession private(
@Stable
object SparkSession extends Logging {
+ private[spark] val numActiveSessions: AtomicInteger = new AtomicInteger(0)
Review comment:
This is error prone and also not easy to debug, we may need to keep track of
each active SparkSession in SparkContext. We don't need to pass in the
SparkSession instance, maybe only compute the `System.identityHashCode()` of
current SparkSession object and pass that to the SparkContext. On
SparkSession.stop() we only need to drop the corresponding identity from
SparkContext, and when it's empty it means we can safely stop the SparkContext,
too.
----------------------------------------------------------------
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]