gpt4 book ai didi

java - Esper窗口使用: Recalculation based on event leaving window

转载 作者:太空宇宙 更新时间:2023-11-04 07:56:12 24 4
gpt4 key购买 nike

我需要这样的东西。

//Create a named window (w1)
Create window w1....

//then insert events into window
insert into w1....
select amount,.....
from....
where...

//remove from window
on RemoveEventArrived as r
Delete from w1
where w1.id = r.id

现在插入 w1 中名为 window 的另一个事件

//inserting into final output event
insert into derivedevent
select sum(w.amount)
from w1 as w

suppose event sequence:
1. Event with id=1 and amount= 100 arrived.
o/p of sum(amount) triggered and gives 100.

2. Event withid = 2 and amount=200 arrived.
o/p of sum(amount) triggered and gives 300.

3. **Remove** Event with id=1 arrived.
o/p of sum(amount) triggered and gives 200.

4. Event with id = 3 and amount=500 arrived
o/p of sum(amount) triggered and gives 700

但第三个事件无法自动触发派生事件重新计算。
当第四个事件到达时触发并根据需要给出输出。
有什么标准的方法吗?

我想计算新事件进入或离开窗口的金额总和。

最佳答案

3.事件(删除)确实会通过“插入派生事件”触发新总和的输出,除非没有删除任何内容,因此您的 id 键可能是错误的。如果仍然遇到问题,请将最小测试用例发送到 esper 用户邮件列表。或者使用 @Audit 查看引擎内部对每个语句执行的操作。

关于java - Esper窗口使用: Recalculation based on event leaving window,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13595930/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com