You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2023/05/16 06:04:40 UTC
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #41013: [SPARK-43509][CONNECT] Support Creating multiple Spark Connect sessions
HyukjinKwon commented on code in PR #41013:
URL: https://github.com/apache/spark/pull/41013#discussion_r1194654026
##########
python/pyspark/sql/session.py:
##########
@@ -394,6 +394,36 @@ def enableHiveSupport(self) -> "SparkSession.Builder":
"""
return self.config("spark.sql.catalogImplementation", "hive")
+ def create(self) -> "SparkSession":
+ """Creates a new SparkSession. Can only be used in the context of Spark Connect
+ and will throw an exception otherwise.
+
+ .. versionadded:: 3.5.0
+
+ Returns
+ -------
+ :class:`SparkSession`
+ """
+ opts = dict(self._options)
+ if "SPARK_REMOTE" in os.environ or "spark.remote" in opts:
+ from pyspark.sql.connect.session import SparkSession as RemoteSparkSession
+
+ url = opts.get("spark.remote", os.environ.get("SPARK_REMOTE"))
Review Comment:
```suggestion
url = opts.get("spark.remote", os.environ.get("SPARK_REMOTE", None))
if url is None:
raise RuntimeError("Spark Connect URL to the server was not found.")
```
--
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