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-3703) Add sequence matching semantics to discard matched events
Date Fri, 19 Aug 2016 14:58:20 GMT

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

ASF GitHub Bot commented on FLINK-3703:

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

    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
    @@ -129,6 +141,23 @@ public Time getWindowTime() {
    +	 * Set a matching behaviour that defines if the same event can be used in multiple matching
    +	 *
    +	 * @param matchingBehaviour New matching behaviour
    +	 * @return The same pattern operator with the specified matching behaviour
    +	 */
    +	public Pattern<T, F> matchingBehaviour(MatchingBehaviour matchingBehaviour) {
    +		Pattern<T, F> pattern = this;
    +		while (pattern != null) {
    +			pattern.matchingBehaviour = matchingBehaviour;
    +			pattern = (Pattern<T, F>) pattern.getPrevious();
    +		}
    +		return this;
    --- End diff --
    Looking at the necessary implementation to wire the matching behaviour through all `Pattern`
instances, I wonder whether the `MatchingBehaviour` should rather be given to the `CEP.pattern`
call. There it could be given to the generated `NFA` which is responsible for making sure
that the behaviour is respected. The API would then look like:
    `CEP.pattern(input, pattern, matchingBehaviour)`
    What do you think?

> Add sequence matching semantics to discard matched events
> ---------------------------------------------------------
>                 Key: FLINK-3703
>                 URL: https://issues.apache.org/jira/browse/FLINK-3703
>             Project: Flink
>          Issue Type: Improvement
>          Components: CEP
>    Affects Versions: 1.0.0, 1.1.0
>            Reporter: Till Rohrmann
>            Assignee: Ivan Mushketyk
>            Priority: Minor
> There is no easy way to decide whether events can be part of multiple matching sequences
or not. Currently, the default is that an event can participate in multiple matching sequences.
E.g. if you have the pattern {{Pattern.<Event>begin("a").followedBy("b")}} and the input
event stream {{Event("A"), Event("B"), Event("C")}}, then you will generate the following
matching sequences: {{Event("A"), Event("B")}}, {{Event("A"), Event("C")}} and {{Event("B"),
> It would be useful to allow the user to define where the matching algorithm should continue
after a matching sequence has been found. Possible option values could be 
>  * {{from first}} - continue keeping all events for future matches (that is the current
>  * {{after first}} -  continue after the first element (remove first matching event and
continue with the second event)
>  * {{after last}} - continue after the last element (effectively discarding all elements
of the matching sequence)

This message was sent by Atlassian JIRA

View raw message