HyukjinKwon commented on a change in pull request #30042:
URL: https://github.com/apache/spark/pull/30042#discussion_r506085277



##########
File path: python/pyspark/sql/session.py
##########
@@ -230,7 +230,10 @@ def __init__(self, sparkContext, jsparkSession=None):
             SparkSession._instantiatedSession = self
             SparkSession._activeSession = self
             self._jvm.SparkSession.setDefaultSession(self._jsparkSession)
-            self._jvm.SparkSession.setActiveSession(self._jsparkSession)
+            
self._jvm.java.lang.Class.forName("org.apache.spark.sql.SparkSession$")\
+                .getDeclaredField("MODULE$")\
+                .get(None)\
+                .setActiveSessionInternal(self._jsparkSession)

Review comment:
       Hey, you don't need to manually reflect here. package level private 
accessor is already accessible in Java as you did so you can just mimic it here 
via `getattr(getattr(spark._jvm, "SparkSession$"), 
"MODULE$").setActiveSessionInternal`(...).




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to