You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "jonmio (via GitHub)" <gi...@apache.org> on 2026/02/24 15:39:58 UTC

Re: [PR] [SPARK-55658] SparkSessionBuilder.create in PySpark classic should mirror getOrCreate path as much as possible [spark]

jonmio commented on code in PR #54429:
URL: https://github.com/apache/spark/pull/54429#discussion_r2847927124


##########
python/pyspark/sql/session.py:
##########
@@ -610,12 +610,16 @@ def create(self) -> "SparkSession":
                 from pyspark.core.context import SparkContext
 
                 with self._lock:
-                    # Build SparkConf from options
-                    sparkConf = SparkConf()
-                    for key, value in self._options.items():
-                        sparkConf.set(key, str(value))
-
-                    sc = SparkContext.getOrCreate(sparkConf)
+                    session = SparkSession._instantiatedSession

Review Comment:
   Yes create always returns a new session. We are just reusing the sc of the instantiated session if it exists. I renamed the variables to make this more clear



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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