【发布时间】:2020-06-16 06:46:39
【问题描述】:
在 Esper 在线 (8.5 - https://esper-epl-tryout.appspot.com/epltryout/mainform.html) 似乎 current_timestamp() 单行方法在 WHERE 部分出现时充当缓存的方法。我以前不记得这种行为(我认为它会随着每个事件重新评估)。
即给定:
create schema iotEvent(id string, type string, value double);
SELECT current_timestamp().getSecondOfMinute()%2 as zeroorone
FROM iotEvent
WHERE current_timestamp().getSecondOfMinute()%2=0
以及以下事件流:
iotEvent={id='A', type="pump", value=1.0}
t=t.plus(1 sec)
iotEvent={id='B', type="dump", value=12.0}
t=t.plus(1 sec)
iotEvent={id='C', type="pump", value=4.0}
t=t.plus(1 sec)
iotEvent={id='A', type="dump", value=15.0}
t=t.plus(1 sec)
iotEvent={id='B', type="pump", value=2.0}
t=t.plus(1 sec)
iotEvent={id='A', type="dump", value=3.0}
"zeroorone" 在选择列表迭代值 0,1,0,1,... 正如预期的那样,但 where 表达式仅取 0 或 1,具体取决于初始事件结果。在本例中为 0(因此它始终匹配)。
另一方面:
SELECT current_timestamp().getSecondOfMinute()%2 as zeroorone
FROM iotEvent
WHERE current_timestamp().getSecondOfMinute()%2=1
从不匹配。
我们在 Esper 部署 (v 7) 中看不到这种行为。 8.5 单行方法缓存策略有什么变化吗?这是期望的行为吗?
谢谢!
【问题讨论】:
标签: esper