[
https://issues.apache.org/jira/browse/FLINK-9431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16529124#comment-16529124
]
ASF GitHub Bot commented on FLINK-9431:
---------------------------------------
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
----
> Introduce TimeEnd State to flink cep
> ------------------------------------
>
> Key: FLINK-9431
> URL: https://issues.apache.org/jira/browse/FLINK-9431
> Project: Flink
> Issue Type: Improvement
> Components: CEP
> Affects Versions: 1.4.2
> Reporter: aitozi
> Assignee: aitozi
> Priority: Major
> Labels: pull-request-available
>
> Now flink cep have no support to reach a Final State upon past some time. if
> i use a pattern like
> {code:java}Pattern.begin('A').notFollowedBy("B"){code}, if i want A element
> be emitted after 5minutes, i have no way.
> I want to introduce a timeEnd State to work with notFollowedBy to figure out
> with this scenior.
> It can be used like this
> {code:java}Pattern.begin('A').notFollowedBy("B").timeEnd("end").{code},
> [~dawidwys] [~kkl0u] Is this meaningful?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)