Hi All

I am using spark streaming with kafka streaming for 24/7 

My Code is something like

JavaDStream<String> data = messages.map(new MapData());
JavaPairDStream<String, Iterable&lt;String>> records = data.mapToPair(new
dataPair()).groupByKey(100);
records.print();
JavaPairDStream<String, Double> result = records.mapValues(new
Sum()).updateStateByKey(updateFunction).cache();

result.foreach{
write(result,path); //writing result to the path 
}

Since result holds historcal value , even when there is no input record for
10 min , no change in result i tend to write it again and again for every 3
secs

i tried checking 

if(record.count() > 0 )
{
result.foreach(write file)
}

But spark is not considering my check.. Any insight on how to achieve it



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Streaming-Question-regarding-lazy-calculations-tp17636.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

Reply via email to