我需要有点像这样。
//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 命名窗口插入另一个事件
//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
但有些第三事件无法自动触发派生事件重新计算。
第 4 个事件的到来触发并根据需要提供输出。
有什么标准的做法吗?
我想计算新事件是进入窗口还是离开窗口的总和。