Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/22295#discussion_r215556683 --- Diff: python/pyspark/sql/session.py --- @@ -252,6 +252,16 @@ def newSession(self): """ return self.__class__(self._sc, self._jsparkSession.newSession()) + @since(2.4) + def getActiveSession(self): + """ + Returns the active SparkSession for the current thread, returned by the builder. + >>> s = spark.getActiveSession() + >>> spark._jsparkSession.getDefaultSession().get().equals(s.get()) + True + """ + return self._jsparkSession.getActiveSession() --- End diff -- Yea, I think we should return Python session one. JVM instance should not be exposed .. I assume returning `None` is fine. The thing is, we have the lack of session supports in PySpark. It's partially implemented but not very well tested as far as I can tell. Can you add a set of tests for it, and manually test them as well? Actually, my guys say this is quite a big deal
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org