foreachRDD is an action and doesn't return anything. It seems like you want one final count, but that's not possible with a stream, since there is conceptually no end to a stream of data. You can get a stream of counts, which is what you have already. You can sum those counts in another data structure to get a current total. See the streaming word count examples.
On Fri, Apr 24, 2015 at 1:50 PM, Sergio Jiménez Barrio <[email protected]> wrote: > Hi, > > I need compare the count of messages recived if is 0 or not, but > messages.count() return a DStream[Long]. I tried this solution: > > val cuenta = messages.count().foreachRDD{ rdd => > rdd.first() > } > > But this return a type Unit, not Long. > > > Any suggestion? Thanks! --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
