代码如下
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.java.BatchTableEnvironment;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangkai
* @create 2019/12/18
*/
public class WordCount {
public static void main(String[] args) throws Exception{
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tableEnvironment = BatchTableEnvironment.create(env);
List list = new ArrayList<>();
String[] wordStr = "a,b,a,b,c,a".split(",");
for(String word : wordStr){
list.add(new WC(word,1));
}
DataSet<WC> dataSource = env.fromCollection(list);
tableEnvir