HyukjinKwon commented on code in PR #46435: URL: https://github.com/apache/spark/pull/46435#discussion_r1594800073
########## python/pyspark/sql/connect/session.py: ########## @@ -287,7 +287,17 @@ def _set_default_and_active_session(cls, session: "SparkSession") -> None: @classmethod def getActiveSession(cls) -> Optional["SparkSession"]: - return getattr(cls._active_session, "session", None) + s = getattr(cls._active_session, "session", None) + if s is not None and not s.is_stopped: + return s + return None + + @classmethod + def getDefaultSession(cls) -> Optional["SparkSession"]: Review Comment: Can we avoid adding this as an API in this PR? If we want this, we should add it into `pyspark.sql.session.py` too, and document it at `python/docs/source/reference/pyspark.sql/spark_session.rst`. -- 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