gatorsmile commented on code in PR #53820:
URL: https://github.com/apache/spark/pull/53820#discussion_r2699713706
##########
python/pyspark/sql/session.py:
##########
@@ -598,11 +601,24 @@ def create(self) -> "SparkSession":
os.environ["SPARK_CONNECT_MODE_ENABLED"] = "1"
opts["spark.remote"] = url
return cast(SparkSession,
RemoteSparkSession.builder.config(map=opts).create())
+ # Classic mode
else:
- raise PySparkRuntimeError(
- errorClass="ONLY_SUPPORTED_WITH_SPARK_CONNECT",
- messageParameters={"feature":
"SparkSession.builder.create"},
- )
+ with self._lock:
+ # Build SparkConf from options
+ sparkConf = SparkConf()
+ for key, value in self._options.items():
+ sparkConf.set(key, str(value))
+
+ sc = (
+ self._sc
+ if getattr(self, "_sc", None) is not None and
self._sc._jsc is not None
Review Comment:
In the Class Builder, which function actually sets self._sc? Is it None
always?
CC @HyukjinKwon and @cloud-fan
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]