Github user andrewor14 commented on the pull request:
https://github.com/apache/spark/pull/6269#issuecomment-103720539
Regarding `foreachRDD`, I'm actually pretty confused about one thing.
Currently when we clean the foreach closure we don't check serializability for
the following reason:
```
// because the DStream is reachable from the outer object here, and because
// DStreams can't be serialized with closures, we can't proactively check
// it for serializability and so we pass the optional false to
SparkContext.clean
new ForEachDStream(this, context.sparkContext.clean(foreachFunc,
false)).register()
```
This implies that the closure cannot be serialized ever, which is true
because we pull in the whole `ssc` into the closure in
`ForEachInputDStream#generateJob`:
```
val jobFunc = () => createRDDWithLocalProperties(time) {
ssc.sparkContext.setCallSite(creationSite)
foreachFunc(rdd, time)
}
```
What's the point in cleaning this closure if it can never 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]