我需要一些帮助来创建一个窗口来管理具有以下规则的事件:
customerId
)length_batch
以创建从一个事件到另一个事件的边缘。我的问题是:这可能是最好的方法吗?
我尝试使用groupwin(customerId).length_batch(2)
创建一个窗口,但我找不到添加第一条规则的方法: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()
但未成功。
是否有人帮助/解释我可能有什么好办法呢?
答案 0 :(得分:0)
时间顺序视图命令无序事件。见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