我很难理解这个查询:
from heartbeats#window.time(1 hour) insert expired events into delayedStream;
from every e = heartbeats -> e2 = heartbeats[deviceId == e.deviceId]
or expired = delayedStream[deviceId == e.deviceId]
within 1 hour 10 minutes
select e.deviceId, e2.deviceId as id2, expired.deviceId as id3
insert into tmpStream;
- 第一个查询将所有事件延迟 1 小时。
- 第二个查询过滤了 1 小时前发生的所有事件,并且没有找到更新的事件。
这有效,但我不明白这部分:
从每个 e = heartbeats -> e2 = heartbeats[deviceId == e.deviceId] 或 expired = delayedStream[deviceId == e.deviceId]
查询的第二部分(或 expired = ...)检查具有给定 deviceId 的事件是否在延迟流上。第一部分的目的是什么?它是如何组合在一起的,这个查询会找到超过 1 小时没有发送数据的设备?