GitHub user Aitozi opened a pull request:

    https://github.com/apache/flink/pull/6234

    [FLINK-9431]Introduce time bounded condition to cep

    ## What is the purpose of the change
    
    In cep the event is now driving the transformation of the NFA, I think the 
time factor should also be taken into account in some senior.
    
    When a key's data is not endless, and if we want to match the following 
pattern after we match the `AB` after `B` has appeared for  ten seconds.
    
    ```
    Pattern.begin("A").followedBy("B").notFollowedBy("C")
    ``` 
    We can not emit the result because there is no branch can lead to the 
`Final State`, And i think we can add a `TimeEnd` state to describe a pattern 
that accepts a time condition evaluated by processing time / event time to 
compare the timestamp in the element we have meant before.
    
    As described in the issue link,  there are two main reason why i introduce 
this feature
    
    1.  the `notFollowedBy` cant be at the end of the pattern 
    2.  the `within` just compare with the element at start, and some key's 
data may not endless, so we have to evaluate condition not also on event but 
also on time
    
    ## Brief change log
    
    1.  Add the method to distinguish the event driven condition or time 
drivern condition in `IterativeCondition`
    2.  when `advanceTime`, we not only prune the expire element, but also look 
the time bounded condition
    
    
    ## Verifying this change
    
    This change is already covered by existing cep tests, may be it need a 
little more about the new api.
    
    This change added tests and can be verified as follows:
    
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (yes)
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Aitozi/flink timeEnd-state

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/6234.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #6234
    
----
commit b1aa992a97c8eac818e57c3d2f82be76957052d0
Author: minwenjun <minwenjun@...>
Date:   2018-07-01T14:41:44Z

    [FLINK-9431]Introduce time bounded condition to cep

----


---

Reply via email to