You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by Dominik Wosiński <wo...@gmail.com> on 2020/03/25 09:03:44 UTC
Re: Flink CEP greedy match of single pattern
Hey, thanks for the answer.
But if I add the *AfterMatchSkipStrategy* it simply seems to emit event by
event so in the case described above it does emit: [400], [500]
Shouldn't the *greedy* quantifier guarantee that this will be matched as
many times as possible thus creating [400, 500] ??
Thanks again.
Best Regards,
Dom.
Re: Flink CEP greedy match of single pattern
Posted by Dawid Wysakowicz <dw...@apache.org>.
Hi Dominik,
I think you are hitting a bug. The greedy quantifier does not work well
if applied for the last element of a pattern. There is a jira issue to
improve support for greedy qualifier[1].
You could work it around with adding an additional state at the end. E.g. :
Pattern.begin[AccelVector](EventPatternName,
AfterMatchSkipStrategy.skipPastLastEvent())
.where(_.data() > Threshold)
.oneOrMore
.greedy
.consecutive()
.next("b")
.where(BooleanConditions.true())
.within(Time.minutes(1))
Best,
Dawid
[1] https://issues.apache.org/jira/browse/FLINK-10587
On 25/03/2020 10:07, Dominik Wosiński wrote:
> P.S.
> So now my pattern looks like this:
>
> Pattern.begin[AccelVector](EventPatternName,
> AfterMatchSkipStrategy.skipPastLastEvent())
> .where(_.data() > Threshold)
> .oneOrMore
> .greedy
> .consecutive()
> .within(Time.minutes(1))
>
>
> śr., 25 mar 2020 o 10:03 Dominik Wosiński <wo...@gmail.com> napisał(a):
>
>> Hey, thanks for the answer.
>>
>> But if I add the *AfterMatchSkipStrategy* it simply seems to emit event
>> by event so in the case described above it does emit: [400], [500]
>> Shouldn't the *greedy* quantifier guarantee that this will be matched as
>> many times as possible thus creating [400, 500] ??
>>
>> Thanks again.
>> Best Regards,
>> Dom.
>>
Re: Flink CEP greedy match of single pattern
Posted by Dominik Wosiński <wo...@gmail.com>.
P.S.
So now my pattern looks like this:
Pattern.begin[AccelVector](EventPatternName,
AfterMatchSkipStrategy.skipPastLastEvent())
.where(_.data() > Threshold)
.oneOrMore
.greedy
.consecutive()
.within(Time.minutes(1))
śr., 25 mar 2020 o 10:03 Dominik Wosiński <wo...@gmail.com> napisał(a):
> Hey, thanks for the answer.
>
> But if I add the *AfterMatchSkipStrategy* it simply seems to emit event
> by event so in the case described above it does emit: [400], [500]
> Shouldn't the *greedy* quantifier guarantee that this will be matched as
> many times as possible thus creating [400, 500] ??
>
> Thanks again.
> Best Regards,
> Dom.
>