You can also use Update by key interface to store this shared variable. As
for count you can use foreachRDD to run counts on RDD & then store that as
another RDD or put it in updatebykey

Mayur Rustagi
Ph: +1 (760) 203 3257
http://www.sigmoidanalytics.com
@mayur_rustagi <https://twitter.com/mayur_rustagi>



On Fri, Aug 8, 2014 at 11:46 AM, Soumitra Kumar <kumar.soumi...@gmail.com>
wrote:

> Hello,
>
> I want to count the number of elements in the DStream, like RDD.count() .
> Since there is no such method in DStream, I thought of using DStream.count
> and use the accumulator.
>
> How do I do DStream.count() to count the number of elements in a DStream?
>
> How do I create a shared variable in Spark Streaming?
>
> -Soumitra.
>

Reply via email to