根据查询结果按设备对齐,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
您的 SQL 查询确实会删除
heapId
最后一个值为 null
的行,但这并不能有效减少从磁盘或网络检索的数据量,因为此过滤是在事后完成的。
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 是否可以过滤掉具有空值的数据行?