cloud-fan commented on a change in pull request #28128: URL: https://github.com/apache/spark/pull/28128#discussion_r427964959
########## File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala ########## @@ -940,20 +939,19 @@ object SparkSession extends Logging { options.foreach { case (k, v) => session.initialSessionOptions.put(k, v) } setDefaultSession(session) setActiveSession(session) - - // Register a successfully instantiated context to the singleton. This should be at the - // end of the class definition so that the singleton is updated only if there is no - // exception in the construction of the instance. - sparkContext.addSparkListener(new SparkListener { - override def onApplicationEnd(applicationEnd: SparkListenerApplicationEnd): Unit = { - defaultSession.set(null) - } - }) + registerSessionListenerOnContext(sparkContext) } return session } + private def registerSessionListenerOnContext(sparkContext: SparkContext): Unit = { Review comment: yea a test would be better ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org