Hello all,

I am able to write the Wikipedia edit data to the kafka and as a text file
as per the given example of WikipediaAnalysis. But when I try to write it
as csv, the blank files initially created never gets filled with data.
Below is the code:

DataStream<Tuple2<String, Long>> result =
keyedEdits.timeWindow(Time.seconds(5)).fold(new Tuple2<>("", 0L),
new FoldFunction<WikipediaEditEvent, Tuple2<String, Long>>() {
@Override
public Tuple2<String, Long> fold(Tuple2<String, Long> acc,
WikipediaEditEvent event) {
acc.f0 = event.getUser();
acc.f1 += event.getByteDiff();
return acc;
}
});

*result.writeAsText("file:///home/softwares/flink-1.0.0/kmeans/streaming/result",
FileSystem.WriteMode.OVERWRITE); *-------------------------> works

*result.writeAsCsv("file:///home/softwares/flink-1.0.0/kmeans/streaming/result",
FileSystem.WriteMode.OVERWRITE);* --------------------------> doesn't work

Why is data getting written to file as text but not as csv?

Best Regards,
Subash Basnet

Reply via email to