Github user kl0u commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4331#discussion_r132898814
  
    --- Diff: 
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java ---
    @@ -340,6 +362,65 @@ public void resetNFAChanged() {
                return Tuple2.of(result, timeoutResult);
        }
     
    +   private void 
discardComputationStatesAccordingToStrategy(Queue<ComputationState<T>> 
computationStates,
    --- End diff --
    
    This method is very fragile as it makes the assumption that the different 
patterns appear in the match in the order that they were declared in the 
pattern declaration, e.g. for a pattern `A -> B -> C` it assumes that the 
partial matches will appear in the order [`matches for A`, `matches for B`, 
`matches for C`]. This is *NOT* correct as we use a `HashMap` which does not 
provide any ordering guarantees. 
    
    A quick fix would be to use a `LinkedHashMap` as the return type for the 
`extractCurrentMatches` and put the results there in the correct order.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to