FlinkCEP: pattern application on a KeyedStream

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FlinkCEP: pattern application on a KeyedStream

Federico D'Ambrosio
Hi all,

I was wondering if it is correct to assume the application of a pattern on a KeyedStream similar to the application, e.g., of a MapFunction when it comes to state.

For example, the following

val pattern = ...
val keyedStream = stream.keyBy("id")

val patternKeyedStream = CEP.pattern(pattern, keyedStream)

val anotherKeyedStream = patternKeyedStream.select(...)

should only check the pattern on each single partition value.

Am I correct in assuming this, or I have misunderstood CEP functioning?

--
Federico D'Ambrosio
Reply | Threaded
Open this post in threaded view
|

Re: FlinkCEP: pattern application on a KeyedStream

Kostas Kloudas
Hi Federico,

If I understand your question correctly, then yes, the application of a Pattern on a keyed stream 
is similar to the application of a map function.

It will search for the pattern on each per-key stream of data.
So there will be state (buffer with partial matches, queued elements, etc) for every active key.

Cheers,
Kostas

On Oct 19, 2017, at 11:55 AM, Federico D'Ambrosio <[hidden email]> wrote:

Hi all,

I was wondering if it is correct to assume the application of a pattern on a KeyedStream similar to the application, e.g., of a MapFunction when it comes to state.

For example, the following

val pattern = ...
val keyedStream = stream.keyBy("id")

val patternKeyedStream = CEP.pattern(pattern, keyedStream)

val anotherKeyedStream = patternKeyedStream.select(...)

should only check the pattern on each single partition value.

Am I correct in assuming this, or I have misunderstood CEP functioning?

--
Federico D'Ambrosio