You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Federico D'Ambrosio <fe...@smartlab.ws> on 2017/10/19 09:55:11 UTC

FlinkCEP: pattern application on a KeyedStream

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

Re: FlinkCEP: pattern application on a KeyedStream

Posted by Kostas Kloudas <k....@data-artisans.com>.
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 <fe...@smartlab.ws> 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