afavaro 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_r381168699
 
 

 ##########
 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:
   How about this?

----------------------------------------------------------------
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

Reply via email to