Like this?
messages.foreachRDD(rdd = {
if(rdd.count() 0) //Do whatever you want.
})
Thanks
Best Regards
On Fri, Apr 24, 2015 at 11:20 PM, Sergio Jiménez Barrio
drarse.a...@gmail.com wrote:
Hi,
I need compare the count of messages recived if is 0 or not, but
messages.count() return a
It is solved. Thank u! Is more efficient
messages.foreachRDD(rdd = {
if(!rdd.isEmpty) //Do whatever you want.
})
2015-04-25 19:21 GMT+02:00 Akhil Das ak...@sigmoidanalytics.com:
Like this?
messages.foreachRDD(rdd = {
if(rdd.count() 0) //Do whatever you want.
})
Thanks
Best
Sorry for my explanation, my English is bad. I just need obtain the Long
containing of the DStream created by messages.count(). Thanks for all.
2015-04-24 20:00 GMT+02:00 Sean Owen so...@cloudera.com:
Do you mean an RDD? I don't think it makes sense to ask if the DStream
has data; it may have
But if a use messages.count().print this show a single number :/
2015-04-24 20:22 GMT+02:00 Sean Owen so...@cloudera.com:
It's not a Long. it's an infinite stream of Longs.
On Fri, Apr 24, 2015 at 2:20 PM, Sergio Jiménez Barrio
drarse.a...@gmail.com wrote:
It isn't the sum. This is de
The sum? you just need to use an accumulator to sum the counts or something.
On Fri, Apr 24, 2015 at 2:14 PM, Sergio Jiménez Barrio
drarse.a...@gmail.com wrote:
Sorry for my explanation, my English is bad. I just need obtain the Long
containing of the DStream created by messages.count().
No, it prints each Long in that stream, forever. Have a look at the DStream API.
On Fri, Apr 24, 2015 at 2:24 PM, Sergio Jiménez Barrio
drarse.a...@gmail.com wrote:
But if a use messages.count().print this show a single number :/
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
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