HyukjinKwon commented on code in PR #47434:
URL: https://github.com/apache/spark/pull/47434#discussion_r1685869245
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -890,7 +891,57 @@ object SparkSession extends Logging {
// the remote() function, as it takes precedence over the SPARK_REMOTE
environment variable.
private val builder = SparkConnectClient.builder().loadFromEnvironment()
private var client: SparkConnectClient = _
- private[this] val options = new scala.collection.mutable.HashMap[String,
String]
+ private var server: Option[Process] = None
+ private[this] lazy val options = {
+ val configs: Map[String, String] =
+ sys.props
+ .filter(p =>
+ p._1.startsWith("spark.") &&
+ p._2.nonEmpty &&
+ // Don't include spark.remote that we manually set later.
+ !p._1.startsWith("spark.remote") &&
+ // We use Driver class path in spark-shell. Exclude it.
+ !p._1.startsWith("spark.driver.extraClassPath"))
+ .toMap
+ val map = new scala.collection.mutable.HashMap[String, String]
+ map.addAll(configs)
+ }
+ private def remoteString: Option[String] = {
+ options
+ .get("spark.remote")
+ .orElse(Option(System.getProperty("spark.remote"))) // Set from Spark
Submit
+ .orElse(sys.env.get(SparkConnectClient.SPARK_REMOTE))
+ }
+
+ private def withLocalConnectServer[T](f: => T): T = {
+ if (remoteString.exists(_.startsWith("local"))) {
Review Comment:
There are some duplicate changes with
https://github.com/apache/spark/pull/47402. Once that's merged, I will refactor
codes to deduplicate them.
--
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]