create stream if not exists lute_iot_device.t31_daily_stats_stream_min_max_avg_3 interval(1m) sliding (1m) from lute_iot_device.product_property_3yhuya partition by device_name stream_options (fill_history (1)) into lute_iot_device.t31_daily_stats_xxx333 output_subtable ( concat(‘t31_daily_xxx333sub_’, lower(device_name)) ) tags (device_name varchar(64) as device_name) as select _twstart as ts, _tlocaltime as calculate_time, _twend as window_end, round(avg(temperature), 2) as avg_temperature, max( case when identifier = ‘high_temperature_alarm’ then temperature else null end ) as max_temperature, min( case when identifier = ‘low_temperature_alarm’ then temperature else null end ) as min_temperature, uid from lute_iot_device.product_property_3yhuya partition by device_name, uid; 1分钟统计1次提示查询错误
图形化查询报错,然后我换这个流语法create stream if not exists lute_iot_device.t31_daily_stats_stream_min_max_avg interval(1d) sliding(1d) from lute_iot_device.product_property_3yhuya partition by device_name stream_options(watermark(2m) | fill_history(1)) into lute_iot_device.t31_daily_stats output_subtable(concat(‘t31_daily_sub_’, lower(device_name))) tags (device_name varchar(64) as device_name) as select _twstart as ts, now() as calculate_time, _twend as window_end, round(avg(temperature), 2) as avg_temperature, max(case when identifier = ‘high_temperature_alarm’ then temperature else null end) as max_temperature, min(case when identifier = ‘low_temperature_alarm’ then temperature else null end) as min_temperature, uid from lute_iot_device.product_property_3yhuya partition by device_name, uid; 换成了now函数 他不统计上一天的数据了。