HyukjinKwon commented on code in PR #37117: URL: https://github.com/apache/spark/pull/37117#discussion_r918728918
########## python/pyspark/ml/util.py: ########## @@ -536,10 +536,8 @@ def __get_class(clazz: str) -> Type[RL]: """ parts = clazz.split(".") module = ".".join(parts[:-1]) - m = __import__(module) - for comp in parts[1:]: - m = getattr(m, comp) - return m + m = __import__(module, fromlist=[parts[-1]]) + return getattr(m, parts[-1]) Review Comment: Hm, I think this changes the semantic. Previously, it returned the left-most import but now it returns right-most package. For example, ```python >>> __import__("pyspark", fromlist=['sql']) <module 'pyspark' from '/.../spark/python/pyspark/__init__.py'> >>> m = __import__("pyspark") >>> getattr(m, "sql") <module 'pyspark.sql' from '/.../spark/python/pyspark/sql/__init__.py'> ``` -- 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