Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/16454#discussion_r94905140 --- Diff: python/pyspark/sql/session.py --- @@ -214,8 +214,14 @@ def __init__(self, sparkContext, jsparkSession=None): self._wrapped = SQLContext(self._sc, self, self._jwrapped) _monkey_patch_RDD(self) install_exception_handler() - if SparkSession._instantiatedContext is None: - SparkSession._instantiatedContext = self + if SparkSession._instantiatedSession is None: + SparkSession._instantiatedSession = self + else: + # If we had an instantiated SparkSession attached with a SparkContext + # which is stopped now, we need to renew the instantiated SparkSession. + # Otherwise, we will use invalid SparkSession when we call Builder.getOrCreate. + if SparkSession._instantiatedSession._sc._jsc is None: + SparkSession._instantiatedSession = self --- End diff -- `SparkSession._instantiatedSession._sc` is from the `sparkContext` passed into `__init__`. I think it should not be None.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org