Return-Path: X-Original-To: apmail-flink-user-archive@minotaur.apache.org Delivered-To: apmail-flink-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D3E71992C for ; Tue, 5 Apr 2016 11:42:24 +0000 (UTC) Received: (qmail 10420 invoked by uid 500); 5 Apr 2016 11:42:24 -0000 Delivered-To: apmail-flink-user-archive@flink.apache.org Received: (qmail 10335 invoked by uid 500); 5 Apr 2016 11:42:24 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@flink.apache.org Delivered-To: mailing list user@flink.apache.org Received: (qmail 10326 invoked by uid 99); 5 Apr 2016 11:42:23 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2016 11:42:23 +0000 Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 5E7D71A023C for ; Tue, 5 Apr 2016 11:42:23 +0000 (UTC) Received: by mail-wm0-f43.google.com with SMTP id n3so17753441wmn.0 for ; Tue, 05 Apr 2016 04:42:23 -0700 (PDT) X-Gm-Message-State: AD7BkJI39FDqwDNh+SJTtpRrOiaV0XOnnSGof2G+H0opKw2cA8ZXB8dsLMhHOry1TpcaoDcSt+AxRNNt+P0vHQ== MIME-Version: 1.0 X-Received: by 10.28.214.6 with SMTP id n6mr17593192wmg.49.1459856541908; Tue, 05 Apr 2016 04:42:21 -0700 (PDT) Received: by 10.194.122.229 with HTTP; Tue, 5 Apr 2016 04:42:21 -0700 (PDT) In-Reply-To: References: Date: Tue, 5 Apr 2016 13:42:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: CEP API: Question on FollowedBy From: Till Rohrmann To: user@flink.apache.org Content-Type: multipart/alternative; boundary=001a114680869a865d052fbb565f --001a114680869a865d052fbb565f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes exactly. This is a feature which we still have to add. On Tue, Apr 5, 2016 at 1:07 PM, Anwar Rizal wrote: > Thanks Till. > > The only way I can change the behavior would be to post filter the result > then. > > Anwar. > > On Tue, Apr 5, 2016 at 11:41 AM, Till Rohrmann > wrote: > >> Hi Anwar, >> >> yes, once we have published the introductory blog post about the CEP >> library, we will also publish a more in-depth description of the approac= h >> we have implemented. To spoil it a little bit: We have mainly followed t= he >> paper =E2=80=9CEfficient Pattern Matching over Event Streams=E2=80=9D fo= r the >> implementation. >> >> Concerning your questions: >> >> 1.) followedBy means that there can be an arbitrary sequence of events >> between two matching events, as long as they occur in the specified time >> interval. Thus, TemperatureEvent(40) will match together with >> TemperaturEvent(50), TemperaturEvent(70), TemperaturEvent(65) and >> TemperaturEvent(60). >> >> 2.) The same applies here for the next operator. It says that the second >> matching event has to follow directly after the previous matched event. >> However, a matching event can be part of multiple matching sequences. Th= us, >> you will get TemperaturEvent(70), TemperaturEvent(65) and >> TemperaturEvent(65), TemperaturEvent(60) as two distinct matching sequen= ces. >> >> To make a long story short, there is currently no option to change the >> sequence semantics so that events are only part of one matching sequence= . >> At the moment, events can participate in multiple matching sequences. I >> hope that answers your question Anwar. >> >> Cheers, >> Till >> =E2=80=8B >> >> On Mon, Apr 4, 2016 at 11:18 AM, Anwar Rizal wrote= : >> >>> 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/l= ibs/cep.html >>> , >>> >>> >>> >>> Non-strict contiguity means that other events are allowed to occur >>> in-between two matching events. A non-strict contiguity pattern state c= an >>> be created via the followedBy method. >>> >>> Pattern nonStrictNext =3D start.followedBy("middle"); >>> >>> >>> >>> >>> 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. >>> >>> >>> >>> >>> >>> >>> >>> >> >> > --001a114680869a865d052fbb565f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes exactly. This is a feature which we still have to add.=

On Tue, Apr= 5, 2016 at 1:07 PM, Anwar Rizal <anrizal05@gmail.com> wro= te:
Thanks Till.=C2=A0
The only way I can change the behavior would be to post f= ilter the result then.=C2=A0

Anwar.

On Tue, Apr 5, 2016 at 11:41 AM, Till Rohrmann <= trohrmann@apache.= org> wrote:

Hi Anwar,

yes, once we have published the= introductory blog post about the CEP library, we will also publish a more = in-depth description of the approach we have implemented. To spoil it a lit= tle bit: We have mainly followed the paper =E2=80=9CEfficient Pattern Match= ing over Event Streams=E2=80=9D for the implementation.

Concerning your questions:

1.) followedBy= means that there can be an arbitrary sequence of events between two= matching events, as long as they occur in the specified time interval. Thu= s, TemperatureEvent(40) will match together with TemperaturEvent(50), Tempe= raturEvent(70), TemperaturEvent(65) and TemperaturEvent(60).

2.) The same applies here for t= he next operator. It says that the second matching = event has to follow directly after the previous matched event. However, a m= atching event can be part of multiple matching sequences. Thus, you will ge= t TemperaturEvent(70), TemperaturEvent(65) and TemperaturEvent(65), Tempera= turEvent(60) as two distinct matching sequences.

To make a long story short, the= re is currently no option to change the sequence semantics so that events a= re only part of one matching sequence. At the moment, events can participat= e in multiple matching sequences. I hope that answers your question Anwar.<= /p>

Cheers,
Till

=E2=80=8B

On Mon, Apr 4, 2016 at 11:= 18 AM, Anwar Rizal <anrizal05@gmail.com> wrote:
Hi All,

<= div>
I saw Till's blog preparation. It will be a very hel= pful blog. I hope that some other blogs that explain how it works will come= soon :-)

I have a question on followedBy pattern = matching semantic.=C2=A0


<citaton>

Non-strict contiguity means that other e= vents are allowed to occur in-between two matching events. A non-strict con= tiguity pattern state can be created via the=C2=A0followedBy=C2=A0method.

=
Pattern<Event, ?> nonSt=
rictNext =3D start.followedBy("middle");

</citatio= n>

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 t= ime window that corresponds to the within clause (say in 20 minutes).
=
=C2=A0
TemperatureEvent(40) , OtherEvent(...), TemperatureEv= ent(30), TemperatureEvent(50), OtherEvent(...), TemperatureEvent(70), Tempe= ratureEvent(65), TemperatureEvent(60)

say I want t= o match two TemperatureEvents whose temperatures > 35.=C2=A0
<= br>
What will be the matches in this case ?

<= div>
  • =C2=A0Will TemperatureEvent(40) , TemperatureEvent(50), match ?= (because we have TemperatureEvent(30) at time 3 that does not match.=C2=A0=
  • Will TemperatureEvent(40) , TemperatureEvent(70) match ? (beca= use the pair matches also the specification of pattern , the difference is = we have TemperatureEvent(50) which happened before TempertureEvent(70) ). S= imilar question for TemperatureEvent(40) - TemperatureEvent(65) and Tempera= tureEvent(50)-TemperatureEvent(65) etc. pairs.

=

--
Second question.
For n= ext (and also for followedBy) , I have also questions regarding example abo= ve:
Will TemperatureEvent(70), TemperatureEvent(65) and Temperatu= reEvent(65), TemperatureEvent(60) be returned , or the second pair is no lo= nger returned because TemperatureEvent(65) has been used in the first pair = ?



Is there a way to = define the different sequence semantics =C2=A0for the two questions I asked= above ?=C2=A0


Thanks,
An= war.



=C2=A0


=C2=A0



--001a114680869a865d052fbb565f--