You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Yue Ma (Jira)" <ji...@apache.org> on 2022/03/31 06:47:00 UTC

[jira] [Created] (FLINK-26941) Support Pattern end with notFollowedBy with window

Yue Ma created FLINK-26941:
------------------------------

             Summary: Support Pattern end with notFollowedBy with window
                 Key: FLINK-26941
                 URL: https://issues.apache.org/jira/browse/FLINK-26941
             Project: Flink
          Issue Type: Improvement
          Components: Library / CEP
    Affects Versions: 1.14.4
            Reporter: Yue Ma
             Fix For: 1.14.4


Currently a pattern sequence cannot end in notFollowedBy() in Flink CEP. But in fact, this requirement exists in many scenarios. As mentioned in the following tickets:

https://issues.apache.org/jira/browse/FLINK-16010
https://issues.apache.org/jira/browse/FLINK-9431

Unfortunately, these tickets are not active for a long time.But we still think this is an important feature for Flink CEP, so we would like to share our implementation.
if we want to find the users who created an order but didn't pay in 10 minutes. We could code like this:
Pattern.begin('create').notFollowedBy('pay_order').withIn(10min)
If we receive the create event but don't receive the pay event within 10 minutes, then the match will be successful.

The idea of implementation is basically the same as the design of FLINK-16010.
A Pending State is introduced to represent the state of waiting for a timeout, and there is a take edge between the Pending node and the Stop node.
When advanceTime, if it is found that the pending node has timed out, then extract the timeout sequence and output it normally as successed matched sequence.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)