ifuleyou 发表于 2017-12-24 17:32:54

Flink实战(1)

  Created by shenfeng on 2017/4/18.
  
*/

  
public>  
public static void main(String[] args) throws Exception {
  
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  

DataSet<String> text = env.fromElements(  "Who's there?",
  "I think I hear them. Stand, ho! Who's there?");
  

  
DataSet<Tuple2<String, Integer>> wordCounts = text
  .flatMap(new LineSplitter())
  .groupBy(0)
  .sum(1);
  

  
wordCounts.print();
  

  
env.execute("Word Count Example");
  

  }

  public static>
页: [1]
查看完整版本: Flink实战(1)