Thanks all,

yes, i did using foreachRDD, the following is my code:

var count = -1L // a global variable in the main object

val currentBatch = some_DStream
val countDStream = currentBatch.map(o=>{
      *count = 0L  *// reset the count variable in each batch
      o
    })
countDStream.foreachRDD(rdd=>{println(s); s += rdd.count()})

the variable count stores the number of records of each batch, but it can't
be reset to 0.
I mean this statement *count = 0L *does not work. is my code right?



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Spark-streaming-size-of-DStream-tp13769p13778.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to