【发布时间】:2014-06-30 22:50:45
【问题描述】:
我正在向 esper 发送城市名称、公司名称。
这些查询将在 5 秒内计算名称公司对的出现次数:
create context FiveSecondsContext start @now end after 5 seconds;
context FiveSecondsContext
insert into AggregatedEvent1
select count(*) as count, company, name from eBay group by name, company output snapshot when terminated;
下面的查询应该在 FiveSecondsContext 的末尾给出每个城市的最大计数。就我对 SQL 的了解而言,这似乎是正确的,但它并没有给我最大值,它返回 AggregatedEvent1 中的所有行。
insert into AggrEvent2
select max(count) as value, company, name from AggregatedEvent1 group by name;
由于上面出错了,下面我的查询
select count(*) as cnt, company from AggrEvent2 group by company;
它试图计算公司(例如:“yahoo”)具有最大计数的城市名称也会出错,并在初始查询输入中为我提供公司名称的所有出现次数。
- 要么是 groupby 子句的问题,要么是
- 我需要确定查询运行的顺序。因为我只有为 AggregatedEvent1 定义的上下文。
【问题讨论】:
标签: streaming complex-event-processing esper