zhengruifeng commented on code in PR #50199: URL: https://github.com/apache/spark/pull/50199#discussion_r1992343085
########## python/pyspark/ml/util.py: ########## @@ -113,6 +113,11 @@ def invoke_remote_attribute_relation( methods, obj_ref = _extract_id_methods(instance._java_obj) methods.append(pb2.Fetch.Method(method=method, args=serialize(session.client, *args))) plan = AttributeRelation(obj_ref, methods) + + # To delay the GC of the model, keep a reference to the source instance, + # might be a model or a summary. + plan.__source_instance__ = instance # type: ignore[attr-defined] Review Comment: case 1: summary.predictions the DF `predictions` hold a reference to `summary` case 2: GMMModel.gaussiansDF the DF `gaussiansDF` hold a reference to `GMMModel` -- 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