hvanhovell commented on code in PR #52200:
URL: https://github.com/apache/spark/pull/52200#discussion_r2388952807


##########
sql/connect/common/src/main/scala/org/apache/spark/sql/connect/SparkSession.scala:
##########
@@ -684,6 +684,34 @@ class SparkSession private[sql] (
     }
   }
 
+  /**
+   * Create a clone of this Spark Connect session on the server side. The 
server-side session
+   * is cloned with all its current state (SQL configurations, temporary 
views, registered
+   * functions, catalog state) copied over to a new independent session. The 
returned cloned
+   * session will remain isolated from this session - any subsequent changes 
to either session's
+   * server-side state will not be reflected in the other.
+   *
+   * @note This creates a new server-side session with a new session ID while 
preserving
+   * the current session's configuration and state.
+   */
+  def cloneSession(): SparkSession = {
+    SparkSession.builder().client(client.cloneSession()).create()
+  }
+
+  /**
+   * Create a clone of this Spark Connect session on the server side with a 
custom session ID.
+   * The server-side session is cloned with all its current state (SQL 
configurations, temporary
+   * views, registered functions, catalog state) copied over to a new 
independent session with
+   * the specified session ID. The returned cloned session will remain 
isolated from this session.
+   *
+   * @param sessionId The custom session ID to use for the cloned session 
(must be a valid UUID)
+   * @note This creates a new server-side session with the specified session 
ID while preserving
+   * the current session's configuration and state.
+   */
+  def cloneSession(sessionId: String): SparkSession = {

Review Comment:
   Please add this method the `org.apache.spark.sql.SparkSession` class as well.



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