flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tzu-Li (Gordon) Tai" <tzuli...@apache.org>
Subject Re: Flink CEP State Change Pattern
Date Thu, 19 Oct 2017 15:13:04 GMT
Hi Philip!

I’m looping in Kostas to this thread. He might be able to provide some insights for your
question.

Cheers,
Gordon

On 14 October 2017 at 8:54:45 PM, Philip Limbeck (philiplimbeck@gmail.com) wrote:

Hi!  

I am quite new to Flink CEP and try to define a state change pattern  
with it. This means that only discrete changes in the event stream  
should be detected i.e.  

a a b b - triggers a single change from a to b  

Considering b the "bad" state, I would like to additionally recognize  
the state change from null (i.e. non-existing state) to b:  

b b b - triggers a single change from null to b  

Initially, I tried to model this behavior as follows:  

Pattern<...>begin("first")  
.where(<detectStateA>)  
.optional()  
.next("second")  
.where(<detectStateB>)  

However, since state b can be detected without state a, having a state  
change from a to b results in two identified patterns:  
a b  
and  
b  

Additionally, when the "bad" state b is already given, every  
subsequent b event will detect a new b pattern which is also not what  
I want.  

When the "optional" keyword is omitted, obviously no initial b events  
are detected.  

I know that Flink 1.4.0 will support AFTER_MATCH_SKIP, which I assume  
would aid in this situation as a single b event will not take part in  
two computation states.  

Being currently stuck with 1.3.2 is there a workaround using Flink CEP  
to enable this behavior?  

I am aware of the fact that this behavior is much easier to build  
using plain Flink.  

Thank you for your support, any help is appreciated.  

Best  
Philip  

Mime
View raw message