慕标5832272
基本同标准的Java程序类似,并且含有一个main()方法。每个程序基本由以下5个部分组成:获取一个ExecutionEnvironment载入或者创建初始输入数据指定数据变换的方式制定计算后的数据输出位置程序执行对照上面的WordCountExample:获取一个ExecutionEnvironmentfinal 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");