According to Passing Functions to Spark,it claims:
accessing fields of the outer object will reference the whole object; To avoid this issue ...
I am considering that what is the risk of flowing code:
class MyClass {
val field = "Hello"
def doStuff(rdd: RDD[String]): RDD[String] = { rdd.map(x => field + x) }
}
references all of this would do any harm ?