use of org.apache.flink.storm.wordcount.operators.WordCountDataPojos.Sentence in project flink by apache.
the class BoltTokenizerWordCountPojo method main.
// *************************************************************************
// PROGRAM
// *************************************************************************
public static void main(final String[] args) throws Exception {
if (!parseParameters(args)) {
return;
}
// set up the execution environment
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// get input data
final DataStream<Sentence> text = getTextDataStream(env);
final DataStream<Tuple2<String, Integer>> counts = text.transform("BoltTokenizerPojo", TypeExtractor.getForObject(new Tuple2<String, Integer>("", 0)), new BoltWrapper<Sentence, Tuple2<String, Integer>>(new BoltTokenizerByName())).keyBy(0).sum(1);
// emit result
if (fileOutput) {
counts.writeAsText(outputPath);
} else {
counts.print();
}
// execute program
env.execute("Streaming WordCount with POJO bolt tokenizer");
}
Aggregations