flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anwar Rizal <anriza...@gmail.com>
Subject CEP API: Question on FollowedBy
Date Mon, 04 Apr 2016 09:18:41 GMT
Hi All,


I saw Till's blog preparation. It will be a very helpful blog. I hope that
some other blogs that explain how it works will come soon :-)

I have a question on followedBy pattern matching semantic.


>From the documentation
https://ci.apache.org/projects/flink/flink-docs-master/apis/streaming/libs/cep.html
,

<citaton>

Non-strict contiguity means that other events are allowed to occur
in-between two matching events. A non-strict contiguity pattern state can
be created via the followedBy method.

Pattern<Event, ?> nonStrictNext = start.followedBy("middle");


</citation>

I try to use Till's examples in the blog, to understand the semantic of
followedBy

--
First question.
Say, I have sequence of temperatures in a time window that corresponds to
the within clause (say in 20 minutes).

TemperatureEvent(40) , OtherEvent(...), TemperatureEvent(30),
TemperatureEvent(50), OtherEvent(...), TemperatureEvent(70),
TemperatureEvent(65), TemperatureEvent(60)

say I want to match two TemperatureEvents whose temperatures > 35.

What will be the matches in this case ?


   -  Will TemperatureEvent(40) , TemperatureEvent(50), match ? (because we
   have TemperatureEvent(30) at time 3 that does not match.
   - Will TemperatureEvent(40) , TemperatureEvent(70) match ? (because the
   pair matches also the specification of pattern , the difference is we have
   TemperatureEvent(50) which happened before TempertureEvent(70) ). Similar
   question for TemperatureEvent(40) - TemperatureEvent(65) and
   TemperatureEvent(50)-TemperatureEvent(65) etc. pairs.



--
Second question.
For next (and also for followedBy) , I have also questions regarding
example above:
Will TemperatureEvent(70), TemperatureEvent(65) and TemperatureEvent(65),
TemperatureEvent(60) be returned , or the second pair is no longer returned
because TemperatureEvent(65) has been used in the first pair ?



Is there a way to define the different sequence semantics  for the two
questions I asked above ?


Thanks,
Anwar.

Mime
View raw message