esper事件不能正确执行聚合逻辑

时间:2013-08-10 09:46:36

标签: esper

我有一个元组:

public class mytuple
{
    private int status;

    private int userid;
    private int location;

    private int count1;
    private int count2;

    // corresponding getter settrs included.
}

我创建两个esper语句EPL:

select mytuple.userid as userid, sum(count1) as count1, sum(count2) as count2
from eventStream where mytuple.status = -1
group by userid, location;

and another EPL statement:

select mytuple.userid as userid, sum(count1) as count1, sum(count2) as count2
from eventStream where mytuple.status = 1
group by userid, location;

事件流在配置中注册。

我面临的问题是,在发出的两个事件中......一个作为status = -1而另一个作为status = +1,我在第一个EPL语句中得到+2的增量计数。

但是,如果只发送一个事件,则流可以完美地工作。 我在这里找不到任何东西?

假设我有一个单独的监听器来创建Esper视图。

1 个答案:

答案 0 :(得分:0)

最好通过Esper用户邮件列表运行此操作,如http://esper.codehaus.org/about/esper/mailinglist.html中所述 创建一个小测试用例并将其发送,确保使用最新版本。

对于过滤,将条件放在括号中,这是首选符号:

从eventStream中选择....(mytuple.status = 1)....