You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2026/08/06 03:55:27 UTC

[PR] [SPARK-58610] Support `cloneSession` in `SparkSession` [spark-connect-swift]

dongjoon-hyun opened a new pull request, #485:
URL: https://github.com/apache/spark-connect-swift/pull/485

   ### What changes were proposed in this pull request?
   
   This PR aims to support `cloneSession` API in `SparkSession` by using the `CloneSession` RPC.
   
   ```swift
   // Clone with a server-generated session ID
   let cloned = try await spark.cloneSession()
   
   // Clone with a custom session ID (must be a valid UUID)
   let cloned = try await spark.cloneSession("00112233-4455-6677-8899-aabbccddeeff")
   ```
   
   - `SparkSession.cloneSession(_ newSessionID: String? = nil)` follows the PySpark API shape (`cloneSession(new_session_id=None)`) and covers both Scala overloads (`cloneSession()` / `cloneSession(sessionId:)`) via the optional parameter.
   - `SparkConnectClient.cloneSession` issues the `CloneSession` RPC and validates that the returned session ID matches the requested one when provided, like the Scala and Python clients.
   - The existing `newSession()` semantics are unchanged, consistent with the Scala client where `newSession()` (fresh empty session) and `cloneSession()` (server-side state clone) are distinct APIs.
   
   ### Why are the changes needed?
   
   The `CloneSession` RPC was added via [SPARK-53455](https://github.com/apache/spark/commit/264ca4dc320c9de52ce53fdbdca8146ea9d1a5b6) and is available since [Apache Spark 4.1.0 (2025-12-11)](https://github.com/apache/spark/releases/tag/v4.1.0). This allows users to create a new independent session that inherits the original session's server-side state (SQL configurations, temporary views, registered functions, catalog state), which `newSession()` cannot provide.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this adds a new API, `SparkSession.cloneSession`. For old servers without `CloneSession` RPC support (Apache Spark 4.0.x), the server error is propagated like the Scala and Python clients.
   
   ### How was this patch tested?
   
   Pass the CIs with the newly added integration tests, `cloneSession` and `cloneSessionWithSessionID`, which verify that the cloned session inherits SQL configurations and temporary views and that subsequent changes to either session are isolated from the other. The tests are guarded to run on Apache Spark 4.1+ servers, and were verified manually against a local Apache Spark 4.2.0 Connect server.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 5


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


Re: [PR] [SPARK-58610] Support `cloneSession` in `SparkSession` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #485:
URL: https://github.com/apache/spark-connect-swift/pull/485#issuecomment-5200958791

   Merged to main


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


Re: [PR] [SPARK-58610] Support `cloneSession` in `SparkSession` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #485:
URL: https://github.com/apache/spark-connect-swift/pull/485#issuecomment-5200953767

   Thank you, @viirya ! 😄 


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


Re: [PR] [SPARK-58610] Support `cloneSession` in `SparkSession` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #485: [SPARK-58610] Support `cloneSession` in `SparkSession`
URL: https://github.com/apache/spark-connect-swift/pull/485


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