高级window配置:顺序+分组+length_batch

Advanced window configuration: order + group + length_batch

我需要一些帮助来创建 window 以使用以下规则管理事件:

我的问题是:这样做的好方法是什么?


我试图用 groupwin(customerId).length_batch(2) 创建一个 window 但我没能找到添加第一条规则的方法:order

我的 EPL 查询:

create window winEdge.std:groupwin(customerId).win:length_batch(2) as select customerId,type,ts from Stream

insert into winEdge customerId,type,ts from Stream

select customerId, 'edge' as type, concatstr(type) as path, count(type) as nb_events, sum(ts) as total_time, (last(ts)-first(ts)) as elapsed, first(ts) as fromTs, last(ts) as toTs from winEdge group by customerId

我尝试添加 order by 条件或使用 ex:time_order() 但没有成功。

有人 help/explain 我有什么好的方法吗?

时间顺序视图对无序事件进行排序。参见 http://espertech.com/esper/release-5.3.0/esper-reference/html_single/index.html#view-time-order

两个 EPL 语句,第一个生成流供第二个使用:

// produce ordered stream
insert rstream into ArrivalTimeOrderedStream
select rstream * from MyTimestampedEvent.ext:time_order(arrival_time, 10 sec);

// aggregate
select first(xxx), last(xxx), ... from ArrivalTimeOrderedStream
.groupwin(customerId).length_batch(2) group by customerid