spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hafiz Mujadid <>
Subject Saving Data only if Dstream is not empty
Date Tue, 09 Dec 2014 05:53:38 GMT
Hi Experts!

I want to save DStream to HDFS only if it is not empty such that it contains
some kafka messages to be stored. What is an efficient way to do this.

           var data = KafkaUtils.createStream[Array[Byte], Array[Byte],
DefaultDecoder, DefaultDecoder]    (ssc, params, topicMap,

    val streams = data.window(Seconds(interval*4),
Seconds(interval*2)).map(x => new String(x))

//what condition can be applied here to store only non empty DStream
    streams.saveAsTextFiles(sink, "msg")

View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message