【问题标题】:current_timestamp() cached results at WHERE clause. Is this the expected behavior?current_timestamp() 在 WHERE 子句中缓存结果。这是预期的行为吗?
【发布时间】: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


    【解决方案1】:

    这可能是由于更激进的过滤器索引规划导致的错误。文档链接是Compiler Filter Expression Analysis。这可以在编译器设置中禁用。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-24
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-29
    相关资源
    最近更新 更多