[ https://issues.apache.org/jira/browse/FLINK-7008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16066205#comment-16066205 ]
ASF GitHub Bot commented on FLINK-7008: --------------------------------------- Github user dawidwys commented on a diff in the pull request: https://github.com/apache/flink/pull/4195#discussion_r124481149 --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractKeyedCEPPatternOperator.java --- @@ -270,10 +270,12 @@ private void updateLastSeenWatermark(long timestamp) { } private void updateNFA(NFA<IN> nfa) throws IOException { - if (nfa.isEmpty()) { - nfaOperatorState.clear(); - } else { - nfaOperatorState.update(nfa); + if (nfa.isNFAChanged()) { + if (nfa.isEmpty()) { + nfaOperatorState.clear(); + } else { + nfaOperatorState.update(nfa); --- End diff -- Shouldn't we reset nfaChanged to {{false}} here? Right now we do not update only if a Pattern did not start. If we have a pattern like: A -> B, and sequence a, c, c, c, c, .... the NFA will be updated after each c nevertheless it does not change, won't it? > Update NFA state only when the NFA changes. > ------------------------------------------- > > Key: FLINK-7008 > URL: https://issues.apache.org/jira/browse/FLINK-7008 > Project: Flink > Issue Type: Improvement > Components: CEP > Affects Versions: 1.3.1 > Reporter: Kostas Kloudas > Assignee: Dian Fu > Fix For: 1.4.0 > > > Currently in the {{AbstractKeyedCEPPatternOperator.updateNFA()}} method we > update the NFA state every time the NFA is touched. This leads to redundant > puts/gets to the state when there are no changes to the NFA itself. -- This message was sent by Atlassian JIRA (v6.4.14#64029)