1. 创建超级表语句CREATE STABLE skywalk_smm.truck (ts timestamp, lng double, lat double, berth_id varchar(20), speed double) TAGS (device_no varchar(20), terminal_id varchar(20), type int);2. 创建流式计算create stream if not exists berthsteam7 trigger at_once watermark 180s ignore update 0 fill_history 1 into skywalk_smm.berthsteam7 as select _wstart as start_time, _wend as end_time ,berth_id,timediff(_wstart,_wend ,1s) as diff,device_no from skywalk_smm.truck partition by tbname state_window(berth_id);3. 状态窗口查询select _wstart as start_time, _wend as end_time ,berth_id,timediff(_wstart,_wend ,1s) as diff,device_no from skywalk_smm.truck partition by tbname state_window(berth_id);
问题:通过流式计算进行统计数据,后台数据跑了一天后,查询某台设备的数据,窗口关闭,并且多了一条不应该存在的窗口数据,正常情况下应该是在同一个窗口里面
现象:
流式计算查询设备sql
SELECT * FROM SKYWALK_SMM.berthsteam7 where device_no =710;
状态窗口查询sql
select * from (select _wstart as start_time, _wend as end_time, berth_id, timediff(_wstart, _wend , 1s) as diff, device_no from skywalk_smm.truck partition by tbname state_window(berth_id) ) t where t.device_no =710;预期结果值
使用流式计算结果应该与状态窗口查询统计的结果一致
1. 创建超级表语句
CREATE STABLE skywalk_smm.truck (ts timestamp, lng double, lat double, berth_id varchar(20), speed double) TAGS (device_no varchar(20), terminal_id varchar(20), type int);
2. 创建流式计算create stream if not exists berthsteam7 trigger at_once watermark 180s ignore update 0 fill_history 1 into skywalk_smm.berthsteam7 as select _wstart as start_time, _wend as end_time ,berth_id,timediff(_wstart,_wend ,1s) as diff,device_no from skywalk_smm.truck partition by tbname state_window(berth_id);
3. 状态窗口查询select _wstart as start_time, _wend as end_time ,berth_id,timediff(_wstart,_wend ,1s) as diff,device_no from skywalk_smm.truck partition by tbname state_window(berth_id);
问题:通过流式计算进行统计数据,后台数据跑了一天后,查询某台设备的数据,窗口关闭,并且多了一条不应该存在的窗口数据,正常情况下应该是在同一个窗口里面 现象: 流式计算查询设备sql
状态窗口查询sql
预期结果值
使用流式计算结果应该与状态窗口查询统计的结果一致
SELECT * FROM SKYWALK_SMM.berthsteam7 where device_no =710;
select * from (select _wstart as start_time, _wend as end_time, berth_id, timediff(_wstart, _wend , 1s) as diff, device_no from skywalk_smm.truck partition by tbname state_window(berth_id) ) t where t.device_no =710;