1
我需要這樣。Esper窗口的使用:基於事件離開窗口的重新計算
//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
,但有些事件3不能自動觸發derivedevent recalculatin。
第4個事件到達時觸發並根據需要輸出。
任何標準的做法?
我想計算一個新事件是否進入窗口或離開它的總量。
我已更新問題請仔細查看。特別是第四項活動根據需要提供o/p。 –