Hi Chandeep, Thanks for response. Issue is the new line feed is lost. All records appear in one line only.
Thanks Ashutosh On Tue, Feb 16, 2016 at 3:26 PM, Chandeep Singh <c...@chandeep.com> wrote: > !rdd.isEmpty() should work but an alternative could be rdd.take(1) != 0 > > On Feb 16, 2016, at 9:33 AM, Ashutosh Kumar <kmr.ashutos...@gmail.com> > wrote: > > I am getting multiple empty files for streaming output for each interval. > To Avoid this I tried > > kStream.foreachRDD(new VoidFunction2<JavaRDD<String>,Time>(){ > > > > > > *public void call(JavaRDD<String> rdd,Time time) throws Exception { > if(!rdd.isEmpty()){ > rdd.saveAsTextFile("filename_"+time.milliseconds()+".csv"); > } }* > This prevents writing of empty files. However this appends line after one > another by removing new lines. All lines are merged. > How do I retain my new line? > > Thanks > > >