Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/5787#discussion_r29447824
--- Diff: core/src/main/scala/org/apache/spark/rdd/PairRDDFunctions.scala
---
@@ -131,7 +131,10 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
lazy val cachedSerializer = SparkEnv.get.serializer.newInstance()
val createZero = () =>
cachedSerializer.deserialize[U](ByteBuffer.wrap(zeroArray))
- combineByKey[U]((v: V) => seqOp(createZero(), v), seqOp, combOp,
partitioner)
+ val cleanedSeqOp = self.context.clean(seqOp)
+ val cleanedCombOp = self.context.clean(combOp)
+ combineByKey[U](
+ (v: V) => cleanedSeqOp(createZero(), v), cleanedSeqOp,
cleanedCombOp, partitioner)
--- End diff --
I think we have a rule here implicitly. All public methods in
RDD(PairRDDFunctions, ...) that accepts closure arguments should be responsible
for cleaning the closures.
So we don't need to track where the closures end up. Just check if the
closure argument is passed to a public method. If so, we don't need to clean
it. Otherwise, it should be cleaned.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]