Hi, I think all the received stream will generate a RDD in each batch duration even there is no data feed in (an empty RDD will be generated). So you cannot use number of RDD to judge whether there is any data received.
One way is to do this in DStream/foreachRDD(), like a.foreachRDD { r => if (r.count() == 0) { do something } else { do some other things. } } You can try it. Thanks Jerry -----Original Message----- From: julyfire [mailto:hellowe...@gmail.com] Sent: Tuesday, September 09, 2014 3:42 PM To: u...@spark.incubator.apache.org Subject: RE: Spark streaming: size of DStream Hi Jerry, Thanks for your reply. I use spark streaming to receive the flume stream, then I need to do a judgement, in each batchDuration, if the received stream has data, then I should do something, if no data, do the other thing. Then I thought the count() can give me the measure, but it returns a DStream, not a number. so is there a way to achieve this case? -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Spark-streaming-size-of-DStream-tp13769p13775.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 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org