current_timestamp()在WHERE子句缓存结果。这是预期的行为吗?

问题描述 投票:1回答:1

在Esper在线(8.5 - https:/esper-epl-tryout.appspot.comepltryoutmainform.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部署中没有看到这种行为(7版)。8.5单行方法缓存策略有什么变化吗,这是我们想要的行为吗?

谢谢!

esper
1个回答
0
投票

这大概是由于更敏捷的过滤器索引规划的一个bug。文档链接是 编译器过滤器表达式分析. 这可以在编译器设置中被禁用。

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