garlandz-db commented on code in PR #52895:
URL: https://github.com/apache/spark/pull/52895#discussion_r2510720053


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectSessionManager.scala:
##########
@@ -48,6 +51,16 @@ class SparkConnectSessionManager extends Logging {
       
.maximumSize(SparkEnv.get.conf.get(CONNECT_SESSION_MANAGER_CLOSED_SESSIONS_TOMBSTONES_SIZE))
       .build[SessionKey, SessionHolderInfo]()
 
+  /**
+   * Initialize the base SparkSession from the provided SparkContext.
+   * This should be called once during SparkConnectService startup.
+   */
+  def initializeBaseSession(sc: SparkContext): Unit = {
+    if (baseSession.isEmpty) {
+      baseSession = 
Some(SparkSession.builder().sparkContext(sc).getOrCreate().newSession())

Review Comment:
   maybe we can make this atomic instead. even though initializeBaseSession 
will only be called once in practice but this could be racy. wdyt @hvanhovell 



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