HyukjinKwon commented on code in PR #47453:
URL: https://github.com/apache/spark/pull/47453#discussion_r1688957892


##########
mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala:
##########
@@ -588,7 +588,7 @@ private[ml] object DefaultParamsReader {
    */
   def loadMetadata(path: String, sc: SparkContext, expectedClassName: String = 
""): Metadata = {
     val metadataPath = new Path(path, "metadata").toString
-    val spark = SparkSession.getActiveSession.get
+    val spark = SparkSession.builder().sparkContext(sc).getOrCreate()

Review Comment:
   It will not be a regression. This is Spark ML which is DataFrame-based MLlib 
by definition. Therefore we should always have default session running. Active 
session is specific to a thread, so it might not exist within the same thread. 
Alternatively we could use `SparkSession.getDefaultSession`.



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

Reply via email to