nija-at opened a new pull request, #46435: URL: https://github.com/apache/spark/pull/46435
### What changes were proposed in this pull request? This is a follow-up to a previous improvement - 7d04d0f0. In some cases, particularly when running older versions of the Spark cluster (3.5), the error actually manifests as a mismatch in the observed server-side session id between calls. With this fix, we also capture this case and ensure that this case is also handled. In addition, we improve the implementation of `getActiveSession()` and introduce a similar `getDefaultSession()` that accounts for stopped sessions. This ensures that all places where default or active session is used, stopped sessions are considered neither default nor active. ### Why are the changes needed? Explained above. ### Does this PR introduce _any_ user-facing change? Previously, when client encounters a session mismatch, a user cannot create a new session. With this change, a user can call `getOrCreate()` on the SparkSession builder and create a new session. ### How was this patch tested? Attached unit tests. ### Was this patch authored or co-authored using generative AI tooling? No. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org