Esper窗口用法:基于事件离开窗口重新计算 [英] Esper window usage: Recalculation based on event leaving window

查看:173
本文介绍了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命名窗口插入另一个事件

Now insert into another event from w1 named 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

但有些第三事件无法自动触发derivedevent recalculatin。

第4个事件的到达触发并根据需要提供输出。

任何标准方式吗?

but somewhat 3rd event could not trigger derivedevent recalculatin automatically.
While arrival of 4th event triggers and gives output as required.
Any standard way of doing it?

我想计算新事件是否到达窗口或离开窗口的金额总和。

推荐答案

3.事件(删除)确实通过插入到derivedevent触发新总和的输出,除非没有删除,因此也许你的id键错了。
如果仍有问题,请将最小测试用例发送到esper用户邮件列表。
或者使用@Audit查看每个语句内部引擎的内容。

The 3. event (remove) does trigger output of a new sum by "insert into derivedevent", unless nothing was removed, therefore perhaps your id keys are wrong. Send a minimal test case to the esper user mailing list if still having trouble. Or use @Audit to see what the engine does internally for each statement.

这篇关于Esper窗口用法:基于事件离开窗口重新计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆