如何查询按设备对齐的数据值,并使用 Apache IoTDB 删除一定数量的设备结果?

问题描述 投票:0回答:2

根据查询结果按设备对齐,Apache IoTDB中是否可以根据一定条件移除部分设备的查询结果?比如我只想从总共几百个粉丝中查询1-20号粉丝的数据,无法根据粉丝数筛选数据。我尝试了以下查询语句,但结果仍然返回数百行数据,而我只想要前 20 行。

有人知道如何编辑此声明吗?

select LAST_VALUE(heapId) as heapId,LAST_VALUE(bunchNo) as bunchNo,LAST_VALUE(no) as no, LAST_VALUE(voltage) as voltage,LAST_VALUE(temperature) as temperature,LAST_VALUE(soc) as soc,LAST_VALUE(soh) as soh from root.station01.cell.bms795717935384768512.bunch01.** where  no  > 0 and no <=20 align by device
time-series alignment iot apache-iotdb iotdb
2个回答
0
投票

您的 SQL 查询确实会删除

heapId
最后一个值为
null
的行,但这并不能有效减少从磁盘或网络检索的数据量,因为此过滤是在事后完成的。


0
投票
select LAST_VALUE(heapId) as heapId, LAST_VALUE(bunchNo) as bunchNo, LAST_VALUE(no) as no, LAST_VALUE(voltage) as voltage, LAST_VALUE(temperature) as temperature, LAST_VALUE(soc) as soc, LAST_VALUE(soh) as soh
from root.station01.cell.bms795717935384768512.bunch01.**
where no > 0 and no <= 20
having LAST_VALUE(heapId) is not null
align by device

尝试此编码,看看 Apache IoTDB 是否可以过滤掉具有空值的数据行?

© www.soinside.com 2019 - 2024. All rights reserved.