HyukjinKwon commented on code in PR #47434:
URL: https://github.com/apache/spark/pull/47434#discussion_r1734017065


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -859,6 +865,49 @@ object SparkSession extends Logging {
     }
   }
 
+  /**
+   * Create a new Spark Connect server to connect locally.
+   */
+  private[sql] def withLocalConnectServer[T](f: => T): T = {
+    synchronized {
+      val remoteString = initOptions
+        .get("spark.remote")
+        .orElse(Option(System.getProperty("spark.remote"))) // Set from Spark 
Submit
+        .orElse(sys.env.get(SparkConnectClient.SPARK_REMOTE))

Review Comment:
   Yeah, they are basically more and less same.
   
   - Here, it gets `remoteString`, and below, check if they are `local[...]` or 
`local-cluster[...]`.
   - If so, it starts a Spark Connect server by either `local[...]` or 
`local-cluster[...]`
   - Then sets `spark.remote` to `sc://localhost"` in order to create a Spark 
Connect client.



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

Reply via email to