srowen commented on a change in pull request #24531: [SPARK-27636][MLLIB]Remove 
cached RDD blocks after PIC execution
URL: https://github.com/apache/spark/pull/24531#discussion_r281042435
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/PowerIterationClustering.scala
 ##########
 @@ -417,6 +435,17 @@ object PowerIterationClustering extends Logging {
       .setK(k)
       .setSeed(0L)
       .run(points.values)
-    points.mapValues(p => model.predict(p)).cache()
+
+    val predict = points.mapValues(p => model.predict(p)).cache()
+    predict.count()
+    points.unpersist()
+    predict
 
 Review comment:
   Why not just not cache `predict` here? that avoids dealing with unpersisting 
in the single caller above.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to