flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-7147) Support greedy quantifier in CEP
Date Fri, 25 Aug 2017 22:47:01 GMT

    [ https://issues.apache.org/jira/browse/FLINK-7147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16142374#comment-16142374
] 

ASF GitHub Bot commented on FLINK-7147:
---------------------------------------

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

    https://github.com/apache/flink/pull/4296#discussion_r135367240
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java
---
    @@ -526,18 +551,32 @@ private boolean isPatternOptional(Pattern<T, ?> pattern) {
     				return createGroupPatternState((GroupPattern) currentPattern, sinkState, proceedState,
isOptional);
     			}
     
    -			final IterativeCondition<T> trueFunction = getTrueFunction();
    -
     			final State<T> singletonState = createState(currentPattern.getName(), State.StateType.Normal);
     			// if event is accepted then all notPatterns previous to the optional states are no
longer valid
     			final State<T> sink = copyWithoutTransitiveNots(sinkState);
     			singletonState.addTake(sink, takeCondition);
     
    +			// if no element accepted the previous nots are still valid.
    +			final IterativeCondition<T> proceedCondition = getTrueFunction();
    +
     			// for the first state of a group pattern, its PROCEED edge should point to the following
state of
     			// that group pattern and the edge will be added at the end of creating the NFA for
that group pattern
     			if (isOptional && !headOfGroup(currentPattern)) {
    -				// if no element accepted the previous nots are still valid.
    -				singletonState.addProceed(proceedState, trueFunction);
    +				if (currentPattern.getQuantifier().hasProperty(Quantifier.QuantifierProperty.GREEDY))
{
    +					final IterativeCondition<T> untilCondition =
    +						(IterativeCondition<T>) currentPattern.getUntilCondition();
    +					if (untilCondition != null) {
    +						singletonState.addProceed(
    +							originalStateMap.get(proceedState.getName()),
    +							new AndCondition<>(proceedCondition, untilCondition));
    --- End diff --
    
    Why is this not wrapped with NotCondition ?


> Support greedy quantifier in CEP
> --------------------------------
>
>                 Key: FLINK-7147
>                 URL: https://issues.apache.org/jira/browse/FLINK-7147
>             Project: Flink
>          Issue Type: Sub-task
>          Components: CEP, Table API & SQL
>            Reporter: Dian Fu
>            Assignee: Dian Fu
>
> Greedy quantifier will try to match the token as many times as possible. For example,
for pattern {{a b* c}} (skip till next is used) and inputs {{a b1 b2 c}}, if the quantifier
for {{b}} is greedy, it will only output {{a b1 b2 c}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message