viirya commented on issue #27610: [SPARK-30856][SQL][PySpark] Fix SQLContext.getOrCreate() when SparkContext is restarted URL: https://github.com/apache/spark/pull/27610#issuecomment-587969445 > > Do we also need to check if SparkContext is stopped when calling SQLContext.getOrCreate? > > It asserts that it's stopped in the Scala `SparkSession` constructor, https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala#L103. So don't know if it's necessary to check again. Do you mean when calling `sparkSession = SparkSession(sc, jsqlContext.sparkSession())`, it asserts the given `sc` is not stopped? I meant in `getOrCreate`, we might need to check if the associated `SparkContext` with old `SQLContext` is stopped. Currently we only check `if cls._instantiatedContext is None:`. When `SparkContext` is stopped, and we call `SQLContext.getOrCreate` with a new `SparkContext`, because `cls._instantiatedContext` is not None, we still return it.
---------------------------------------------------------------- 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org