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 079C019801 for ; Tue, 5 Apr 2016 11:07:55 +0000 (UTC) Received: (qmail 55583 invoked by uid 500); 5 Apr 2016 11:07:54 -0000 Delivered-To: apmail-flink-user-archive@flink.apache.org Received: (qmail 55488 invoked by uid 500); 5 Apr 2016 11:07:54 -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 55478 invoked by uid 99); 5 Apr 2016 11:07:54 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2016 11:07:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1BD30C0362 for ; Tue, 5 Apr 2016 11:07:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.448 X-Spam-Level: * X-Spam-Status: No, score=1.448 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id NvSRGQtst34g for ; Tue, 5 Apr 2016 11:07:52 +0000 (UTC) Received: from mail-ig0-f172.google.com (mail-ig0-f172.google.com [209.85.213.172]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D81A65F19B for ; Tue, 5 Apr 2016 11:07:51 +0000 (UTC) Received: by mail-ig0-f172.google.com with SMTP id g8so10725376igr.0 for ; Tue, 05 Apr 2016 04:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=bmZ9dC0i3tX1JeihdTnr+bOUPTuYNjA3PU/V6QAqIYE=; b=xCtLwYZa36kmI5zcHEZJqBhO/OZOW9eAyipLiL69W2U49nuiA5TTfFoRFEu8XEGA0e 1d2m79jmzHf+X/GkPNxoE/iXkf3oyknuNqzAvJV8dNZbxXrkRIZHcoTURE5pCF1cNhii VR1wza+byx4Q1BhaCOpiTWKRxM65DNqShVbFOw3fG5dYQANtLV1VwW0geF0fpCqkyjaF tVhQNM36Wq5qcoh9E2GegCGb32ofsbdZU74SAKTNQmyQfeB3J44r7rCjSBnSwQodh7vi Zte3jN8DMmihByoMk9DaCrSGWzHkRiVxWV+lzJ59sV3uHlIeP03AZ/uUKfn+Z71G9h+4 q91w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=bmZ9dC0i3tX1JeihdTnr+bOUPTuYNjA3PU/V6QAqIYE=; b=kQXV3pj9RukMW06Gf6KyYIutHSWO0zJ+bgON2/TqtOqNmw/zvVdyt8AkKDpgth7mdR hCqJ+gunuLZE2xaAT6mBSYK7/z2a/qjrxiy5XggOl31IiKLZzQVlGMosF3+p0x5UYEx0 qLIsGW3AK3z1dUCC6nZLGEBX/GR8xq0asnB5qro3oOkf4hPJsSvYQTKDJcTR5BD1Bphf 29N49OoQs174hBxAUm7EWkHCz8CL/DH2mbMi80qFkTE0blOsWjynipcKkjcg1SfbP6+M eWBee3+FRtlIMEsnfawx0Vp6C3hMlnaiGKWW7Tv3URS5lm4oGSRhcV44qhDkNYbbwuFt HtZA== X-Gm-Message-State: AD7BkJKXvHe0vYnmt0m9BA/5scqPXc+OI5mrq4Kr1WCTIU9qDgVItk6ofX8OWiW5lyt7/a0KRwpJTbsjnrat1Q== MIME-Version: 1.0 X-Received: by 10.50.85.14 with SMTP id d14mr16149884igz.49.1459854464851; Tue, 05 Apr 2016 04:07:44 -0700 (PDT) Received: by 10.36.123.23 with HTTP; Tue, 5 Apr 2016 04:07:44 -0700 (PDT) In-Reply-To: References: Date: Tue, 5 Apr 2016 13:07:44 +0200 Message-ID: Subject: Re: CEP API: Question on FollowedBy From: Anwar Rizal To: user@flink.apache.org Content-Type: multipart/alternative; boundary=089e013c7100cd25b1052fbada3e --089e013c7100cd25b1052fbada3e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 approach > we have implemented. To spoil it a little bit: We have mainly followed th= e > paper =E2=80=9CEfficient Pattern Matching 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. 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. Thu= s, > you will get TemperaturEvent(70), TemperaturEvent(65) and > TemperaturEvent(65), TemperaturEvent(60) as two distinct matching sequenc= es. > > 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/li= bs/cep.html >> , >> >> >> >> Non-strict contiguity means that other events are allowed to occur >> in-between two matching events. A non-strict contiguity pattern state ca= n >> 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 t= o >> 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 i= s 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 retur= ned >> 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. >> >> >> >> >> >> >> >> > > --089e013c7100cd25b1052fbada3e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks Till.=C2=A0

The only way I can c= hange the behavior would be to post filter the result then.=C2=A0

Anwar.

On Tue, Apr 5, 2016 at 11:41 AM, Till Rohrmann <troh= rmann@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,


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

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

=

<citaton>

Non-stric= t contiguity means that other events are allowed to occur in-between two ma= tching events. A non-strict contiguity pattern state can be created via the= =C2=A0followedBy=C2=A0method.

<= div style=3D"color:rgb(51,51,51);font-family:'Helvetica Neue',Helve= tica,Arial,sans-serif;font-size:14px;line-height:20px;background-image:init= ial;background-repeat:initial">
=
Pattern<Event=
, ?> nonStrictNext =3D start.=
followedBy("middle"=
);
<= div>
</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 cl= ause (say in 20 minutes).
=C2=A0
TemperatureEvent(40) ,= OtherEvent(...), TemperatureEvent(30), TemperatureEvent(50), OtherEvent(..= .), TemperatureEvent(70), TemperatureEvent(65), TemperatureEvent(60)
<= div>
say I want to match two TemperatureEvents whose temperat= ures > 35.=C2=A0

What will be the matches in th= is case ?

  • =C2=A0Will TemperatureEvent(40) = , TemperatureEvent(50), match ? (because we have TemperatureEvent(30) at ti= me 3 that does not match.=C2=A0
  • Will TemperatureEvent(40) , Tem= peratureEvent(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) - T= emperatureEvent(65) and TemperatureEvent(50)-TemperatureEvent(65) etc. pair= s.


--
S= econd question.
For next (and also for followedBy) , I have also = questions regarding example above:
Will TemperatureEvent(70), Tem= peratureEvent(65) and TemperatureEvent(65), TemperatureEvent(60) be returne= d , or the second pair is no longer returned because TemperatureEvent(65) h= as 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,
Anwar.



=C2=A0


=C2=A0


--089e013c7100cd25b1052fbada3e--