Java 高级窗口配置:order+;组+;批量长度

Java 高级窗口配置:order+;组+;批量长度,java,complex-event-processing,esper,Java,Complex Event Processing,Esper,我需要一些帮助来创建一个窗口,以便使用以下规则管理事件: 获取按时间戳排序的事件(到达可以是无序的) 按键对这些事件进行分组(customerId) 最后,每2个事件进行一次length\u批处理,以创建从一个事件到另一个事件的边缘 我的问题是:做这件事的好方法是什么 我试图用groupwin(customerId).length\u batch(2)创建一个窗口,但我没有找到添加第一条规则的方法:order 我的EPL查询: create window winEdge.std:group

我需要一些帮助来创建一个窗口,以便使用以下规则管理事件:

  • 获取按时间戳排序的事件(到达可以是无序的)
  • 按键对这些事件进行分组(
    customerId
  • 最后,每2个事件进行一次
    length\u批处理
    ,以创建从一个事件到另一个事件的边缘
我的问题是:做这件事的好方法是什么


我试图用
groupwin(customerId).length\u 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,或者使用
ex:time\u 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

谢谢,这很有效。组正确地基于customerId,但聚合查询生成的组不按时间排序。我试图在查询中添加“order by”,但没有成功。当说“聚合查询生成的组不按时间排序”时,我可能会问什么时间?给定组的第一个数据点到达给定批次的时间,或给定组的第一个时间戳,或最后一个或。。。?我听起来像ORDERBY子句可以简单地按“firstever(timestamp)”排序,并且它是事件时间还是生成重新排序的输出时的系统时间?如果我不清楚的话,有这么多未列出的需求。例如,按优先顺序(ts)订购。