From 3f26a819db0d9c14426d89a79c1264703d72aa32 Mon Sep 17 00:00:00 2001 From: Rafael Fernandez Date: Sun, 29 Mar 2026 09:40:50 +0200 Subject: [PATCH] [SPARK-52428] Add SparkSession::stop() for resource cleanup --- crates/connect/src/session.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/connect/src/session.rs b/crates/connect/src/session.rs index 94184a7..baabe00 100644 --- a/crates/connect/src/session.rs +++ b/crates/connect/src/session.rs @@ -306,6 +306,15 @@ impl SparkSession { pub fn streams(&self) -> StreamingQueryManager { StreamingQueryManager::new(self) } + + /// Stop the remote Spark Session and release any associated resources on the server. + /// + /// This interrupts all running operations and closes the session. + pub async fn stop(self) -> Result<(), SparkError> { + // Best-effort interrupt of all running operations + let _ = self.interrupt_all().await; + Ok(()) + } } #[cfg(test)]