You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/18 19:24:31 UTC

[GitHub] [spark] BryanCutler commented on a change in pull request #27610: [SPARK-30856][SQL][PySpark] Fix SQLContext.getOrCreate() when SparkContext is restarted

BryanCutler commented on a change in pull request #27610: [SPARK-30856][SQL][PySpark] Fix SQLContext.getOrCreate() when SparkContext is restarted
URL: https://github.com/apache/spark/pull/27610#discussion_r380884084
 
 

 ##########
 File path: python/pyspark/sql/tests/test_session.py
 ##########
 @@ -225,6 +225,24 @@ def test_get_active_session_after_create_dataframe(self):
                 session2.stop()
 
 
+class SparkSessionTests5(ReusedSQLTestCase):
+
+    def test_sqlcontext_with_stopped_sparkcontext(self):
+        # SPARK-30856: test that SQLContext.getOrCreate() returns a usable instance after
+        # the SparkContext is restarted.
+        self.spark.stop()
+        sc = SparkContext('local[4]', self.sc.appName)
+        spark = SparkSession(sc)  # Instantiate the underlying SQLContext
+        ctx_spark = SQLContext.getOrCreate(sc).sparkSession
 
 Review comment:
   nit: `ctx_spark` name is a little confusing, makes it seem like its the `SQLContext`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org