dongjoon-hyun commented on code in PR #47453: URL: https://github.com/apache/spark/pull/47453#discussion_r1688119867
########## python/pyspark/ml/util.py: ########## @@ -464,10 +464,10 @@ def saveMetadata( metadataJson = DefaultParamsWriter._get_metadata_to_save( instance, sc, extraMetadata, paramMap ) - spark = SparkSession.getActiveSession() - spark.createDataFrame( # type: ignore[union-attr] - [(metadataJson,)], schema=["value"] - ).coalesce(1).write.text(metadataPath) + spark = SparkSession._getActiveSessionOrCreate() Review Comment: ditto. ########## python/pyspark/ml/util.py: ########## @@ -580,8 +580,8 @@ def loadMetadata(path: str, sc: "SparkContext", expectedClassName: str = "") -> If non empty, this is checked against the loaded metadata. """ metadataPath = os.path.join(path, "metadata") - spark = SparkSession.getActiveSession() - metadataStr = spark.read.text(metadataPath).first()[0] # type: ignore[union-attr,index] + spark = SparkSession._getActiveSessionOrCreate() Review Comment: ditto. -- 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