FlinkErr: Unknown call expression: sum(vc)
创始人
2024-12-28 23:05:40
0

public class OverWindowTableApiTest {     public static void main(String[] args) throws Exception {         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();         env.setParallelism(1);         StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env);          DataStreamSource streamSource = env.socketTextStream("hadoop102", 7777);         SingleOutputStreamOperator map = streamSource.map(new MapFunction() {             @Override             public WaterSensor map(String value) throws Exception {                 String[] splits = value.split(",");                  WaterSensor waterSensor = new WaterSensor(splits[0], Long.valueOf(splits[1]), Integer.valueOf(splits[2]));                 return waterSensor;             }         });           // 流转表(指定表结构)         Schema schema = Schema.newBuilder()                 .column("id", "STRING")                 .column("ts", "BIGINT")                 .column("vc", "INT")                 .columnByExpression("pt" , "PROCTIME()")                 .columnByExpression("et", "TO_TIMESTAMP_LTZ(ts, 3)")                 //.watermark("et" , "source_watermark()") // 沿用流中的水位线                 .watermark("et" , "et - INTERVAL '1' SECOND ") // 重新定义水位线                 .build();         Table table = tableEnv.fromDataStream(map, schema);          // API式开窗         OverWindow w1 = Over.partitionBy($("id")).orderBy($("pt")).preceding(UNBOUNDED_ROW).following(CURRENT_ROW).as("w");          table.window(w1)                 .select(                     $("id"), $("ts"), $("vc"), $("et"), $("vc").sum().over($("w")).as("sum_vc")         ).execute().print();          env.execute();     } }

再次运行

 

成功!

相关内容

热门资讯

智星德州辅助译码插件靠谱吗!购... 智星德州辅助译码插件靠谱吗!购买wepoker模拟器,wepoker透视脚本苹果版(详细辅助透明挂教...
透视黑科技!aapoker透视... 透视黑科技!aapoker透视软件,aa poker辅助包(详细辅助爆料教程)1、很好的工具软件,可...
透视插件!wejoker辅助软... 透视插件!wejoker辅助软件,逍遥辅助软件,力荐教程(有挂黑科技)暗藏猫腻,小编详细说明逍遥辅助...
透视美元局!aapoker破解... 透视美元局!aapoker破解侠是真的吗,赣牌圈有挂吗(切实有挂)1、金币登录送、破产送、升级送、活...
透视美元局“wpk脚本下载”总... 透视美元局“wpk脚本下载”总是是真的有挂(辅助挂)详细辅助必备教程;1、ai机器人多个强度级别选择...
wpk透视脚本链接!如何下载w... wpk透视脚本链接!如何下载wpk透视版,wpk辅助工具(详细辅助2025教程)wpk透视脚本链接辅...
透视攻略!aapoker透视插... 透视攻略!aapoker透视插件下载,约局吧德州真的有透视挂吗(详细辅助曝光教程)1、玩家可以在约局...
透视攻略!wepoker开脚本... 透视攻略!wepoker开脚本视频,爱玩辅助(真是真的是有挂)1、爱玩辅助系统规律教程、爱玩辅助辅助...
透视app!pokemmo脚本... 透视app!pokemmo脚本最新版,河洛刚次辅助,安装教程(有挂解说);进入游戏-大厅左侧-新手福...
透视黑科技“wpk辅助插件叫什... 透视黑科技“wpk辅助插件叫什么”真是真的有挂(辅助挂)详细辅助总结教程;1、ai辅助优化,发牌逻辑...