基本Flink1.13版本
//创建StreamTableEnvironment对象
StreamExecutionEnvironment senv = StreamExecutionEnvironment.getExecutionEnvironment();
EnvironmentSettings enset = EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
StreamTableEnvironment tableEnvironment = StreamTableEnvironment.create(senv, enset);
//获取DataStream
ArrayList<Tuple2<Integer,String>> data = new ArrayList<>();
data.add(new Tuple2<>(1,"JACK"));
data.add(new Tuple2<>(2,"TOM"));
data.add(new Tuple2<>(3,"MIKE"));
DataStreamSource<Tuple2<Integer, String>> stream = senv.fromCollection(data);
tableEnvironment.createTemporaryView("myTable", stream, $("id"), $("name"));
tableEnvironment.sqlQuery("select * from myTable where id>1").execute().print();
Table table = tableEnvironment.fromDataStream(stream, $("id"), $("name"));
table.select($("id"), $("name"))
.filter($("id").isGreater(1))
.execute()
.print();
//报错
Exception in thread "main" org.apache.flink.table.api.ValidationException: Too many fields referenced from an atomic type.
at org.apache.flink.table.typeutils.FieldInfoUtils.extractFieldInfoFromAtomicType(FieldInfoUtils.java:473)
是POJO类里没有默认构造方法吗,但是我这个不是对象,是一个List类型,通过fromCollection生成数据源,创建临时视图,这样不行吗