[
https://issues.apache.org/jira/browse/FLINK-7293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16111031#comment-16111031
]
ASF GitHub Bot commented on FLINK-7293:
---------------------------------------
Github user dianfu commented on a diff in the pull request:
https://github.com/apache/flink/pull/4418#discussion_r130896034
--- Diff:
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractKeyedCEPPatternOperator.java
---
@@ -257,7 +289,32 @@ public void onEventTime(InternalTimer<KEY,
VoidNamespace> timer) throws Exceptio
@Override
public void onProcessingTime(InternalTimer<KEY, VoidNamespace> timer)
throws Exception {
- // not used
+ NFA<IN> nfa = getNFA();
+
+ // emit the events in order
+ for (IN event : sort(bufferedEvents.get())) {
+ processEvent(nfa, event,
getProcessingTimeService().getCurrentProcessingTime());
+ }
+
+ // remove all buffered rows
+ bufferedEvents.clear();
+
+ updateNFA(nfa);
+ }
+
+ private Iterable<IN> sort(Iterable<IN> iter) {
+ if (comparator == null) {
+ return iter;
+ } else {
+ // insert all events into the sort buffer
+ List<IN> sortBuffer = new ArrayList<>();
--- End diff --
Good advice. Updated.
> Support custom order by in PatternStream
> ----------------------------------------
>
> Key: FLINK-7293
> URL: https://issues.apache.org/jira/browse/FLINK-7293
> Project: Flink
> Issue Type: Sub-task
> Components: CEP
> Reporter: Dian Fu
> Assignee: Dian Fu
>
> Currently, when {{ProcessingTime}} is configured, the events are fed to NFA
> in the order of the arriving time and when {{EventTime}} is configured, the
> events are fed to NFA in the order of the event time. It should also allow
> custom {{order by}} to allow users to define the order of the events besides
> the above factors.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)