zhengruifeng commented on code in PR #50035: URL: https://github.com/apache/spark/pull/50035#discussion_r1964791234
########## python/pyspark/ml/util.py: ########## @@ -932,7 +932,7 @@ def loadMetadata( If non empty, this is checked against the loaded metadata. """ metadataPath = os.path.join(path, "metadata") - spark = sc if isinstance(sc, SparkSession) else SparkSession._getActiveSessionOrCreate() + spark = cast(SparkSession, sc) if hasattr(sc, "createDataFrame") else SparkSession.active() Review Comment: `sc` can be: - spark context - classic spark session - connect spark session `isinstance(sc, SparkSession)` returns `false` for connect spark session, since we don't have a parent class for sessions -- 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