Can we keep state information across workers through use of CollectionAccumulator[Int] ? RDD is huge
Below is sample code snippet
var valueColl:CollectionAccumulator[Int] = spark.sparkContext.collectionAccumulator("myValue")
rdd.foreachPartition(p => {
val temp:java.util.List[Int] = valueColl.value
if (!temp.contains(p.value)) {
valueColl.add(p.value)
}
}