流计算错误

【TDengine 使用环境】
生产环境 /测试/ Poc/预生产环境

测试环境

【TDengine 版本】

tdengine/tsdb:3.3.8.1

【操作系统以及版本】

centos7

【部署方式】容器/非容器部署

容器

【集群节点数】

单机

【集群副本数】

【描述业务影响】

以上是我的表结构,流计算语法如下:

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次提示查询错误

【问题复现路径/shan】做过哪些操作出现的问题

【遇到的问题:问题现象及影响】

无法查询流计算出来的表

【资源配置】

【报错完整截图】

执行一个简单的sql会报错吗?

是滴 select * from lute_iot_device.t31_daily_stats_xxx333; 我这样简单查询一下就报错了

dbeaver 中 执行sql show databases 会报错吗

show databases; 不会报错

在dbeaver中会提示

在自带的客户端会提示network error

查询那个超级表会报错但是show databases

是没问题的

能使用taos shell,执行select * from lute_iot_device.t31_daily_stats_xxx333;这个sql吗?缩小一下范围,看看是哪个环节在报错

用taos shell没报错 但是

图形化查询报错,然后我换这个流语法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函数 他不统计上一天的数据了。

查询没问题

_tlocaltime这个计算的时间看起来也不对

大佬 可以帮忙看看吗 现在这个问题导致数据无法计算出来了 之前3.3.6.13

是有数据的

用法有问题,你的计算语句里没有指定查询的时间范围,也不应该查询整个超级表且不带分组的过滤,另外now()是在客户端执行的时间,所以也无法达到你的目的,_tlocaltime可以用,但是是有精度的,可以详细看下官网说明和示例。

写法可能和3.3.6.13出入很大 我换了一个写法直接报错,我的一个设备可能被多个人使用我想统计每个设备每个人的信息,上面的写法会提示错误

%%tbname 前面不需要写db名称,因为%%tbname已经可以明确指明查询的库表信息了