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