apache/spark — pull request #2562 by uncleGen (2014-09-28 10:57:26+00:00)
Title: [SPARK-3712][STREAMING]: add a new UpdateDStream to update a rdd dynamically

Maybe, we can achieve the aim by using "forEachRdd" function. But it is weird in this way, because I need to pass a closure, like this:

val baseRdd = ...
var updatedRDD = ...
val inputStream = ...

val func = (rdd: RDD[T], t: Time) => {
updatedRDD = baseRDD.op(rdd)
}

inputStream.foreachRDD(func _)

In my PR, we can update a rdd like:

val updateStream = inputStream.updateRDD(baseRDD, func).asInstanceOf[U, V, T]

and obtain the updatedRDD like this:

val updatedRDD = updateStream.getUpdatedRDD