I have merged that. +1 this also should give 1 output. Thanks for the fixes.
Regards Suho On Mon, May 8, 2017 at 10:18 AM, Nirmal Fernando <nir...@wso2.com> wrote: > Again, I'd only expect one o/p; > Event{timestamp=1494203709496, data=[WSO2, null, 4.7], isExpired=false} > > On Mon, May 8, 2017 at 6:25 AM, Gobinath <slgobin...@gmail.com> wrote: > >> Hi, >> >> I've found a minor bug and sent the PR [1] with the fix. Similar behavior >> is noticed with *or* operator as well (Even after the fix). I have given >> the code and the output below for your concern. >> >> // Query: e1 or e2 -> e3 >> >> define stream Stream1 (symbol string, price float, volume int); >> define stream Stream2 (symbol string, price float, volume int); >> >> @info(name = 'query1') >> from e1=Stream1[price > 20] or e2=Stream2[price >30] -> e3=Stream2['IBM' >> == symbol] >> select e1.symbol as symbol1, e2.price as price2, e3.price as price3 >> insert into OutputStream; >> >> // Input >> Stream1.send(new Object[]{"WSO2", 55.6f, 100}); >> Stream2.send(new Object[]{"GOOG", 72.7f, 100}); >> Stream2.send(new Object[]{"IBM", 4.7f, 100}); >> >> // Output >> Event{timestamp=1494203709496, data=[WSO2, null, 4.7], isExpired=false} >> Event{timestamp=1494203709496, data=[WSO2, null, 4.7], isExpired=false} >> >> If it is also a bug, please do let me know without merging the PR. I will >> fix it under the same PR. >> >> [1] https://github.com/wso2/siddhi/pull/345 >> >> >> Thanks & Regards, >> Gobinath >> >> On Sun, May 7, 2017 at 2:06 PM, Gobinath <slgobin...@gmail.com> wrote: >> >>> Sure. I'll check the issue and send a separate PR with the fix. >>> >>> >>> Thanks & Regards, >>> Gobinath >>> >>> On Sun, May 7, 2017 at 1:51 PM, Sriskandarajah Suhothayan <s...@wso2.com >>> > wrote: >>> >>>> Yes, it looks like a bug to me, can you check why it's happening. >>>> >>>> Regards >>>> Suho >>>> >>>> On Sun, May 7, 2017 at 8:56 PM, Nirmal Fernando <nir...@wso2.com> >>>> wrote: >>>> >>>>> Looks like a bug to me. I would expect only 1 event. >>>>> >>>>> On Sun, May 7, 2017 at 8:49 PM, Gobinath <slgobin...@gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Thanks for accepting my proposal. I have a question regarding the >>>>>> behavior of *and* in a pattern. >>>>>> >>>>>> // Query: e1 and e2 -> e3 >>>>>> >>>>>> define stream Stream1 (symbol string, price float, volume int); >>>>>> define stream Stream2 (symbol string, price float, volume int); >>>>>> >>>>>> @info(name = 'query1') >>>>>> from e1=Stream1[price > 50.0f] and e2=Stream2['IBM' == symbol] -> >>>>>> e3=Stream2[price > 20] >>>>>> select e1.symbol as symbol1, e2.price as price2, e3.price as price3 >>>>>> insert into OutputStream; >>>>>> >>>>>> // Input >>>>>> Stream1.send(new Object[]{"GOOGLE", 72.7f, 100}); >>>>>> Stream2.send(new Object[]{"IBM", 4.7f, 100}); >>>>>> Stream2.send(new Object[]{"WSO2", 55.6f, 100}); >>>>>> >>>>>> >>>>>> // Output >>>>>> Event{timestamp=1494169305631, data=[GOOGLE, 4.7, 55.6], >>>>>> isExpired=false} >>>>>> Event{timestamp=1494169305631, data=[GOOGLE, 4.7, 55.6], >>>>>> isExpired=false} >>>>>> >>>>>> Is this the expected output?. Note that the output contains two >>>>>> exactly similar events but the pattern *e1 -> e2 and e3* outputs a >>>>>> single event [1]. >>>>>> >>>>>> [1] https://github.com/wso2/siddhi/blob/master/modules/siddh >>>>>> i-core/src/test/java/org/wso2/siddhi/core/query/pattern/Logi >>>>>> calPatternTestCase.java#L98 >>>>>> >>>>>> >>>>>> Thanks & Regards, >>>>>> Gobinath >>>>>> >>>>>> On Mon, Apr 17, 2017 at 7:58 AM, Gobinath <slgobin...@gmail.com> >>>>>> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Please see the PR at [1]. Please do not merge it. >>>>>>> >>>>>>> >>>>>>> Thanks & Regards, >>>>>>> Gobinath >>>>>>> >>>>>>> [1] https://github.com/wso2/siddhi/pull/313 >>>>>>> >>>>>>> >>>>>>> On Mon, Apr 17, 2017 at 7:44 AM, Sriskandarajah Suhothayan < >>>>>>> s...@wso2.com> wrote: >>>>>>> >>>>>>>> Based on first look, it looks great. >>>>>>>> >>>>>>>> Can you send it as a PR so I can see the exact implementations and >>>>>>>> also give comments. >>>>>>>> >>>>>>>> Regards >>>>>>>> Suho >>>>>>>> >>>>>>>> On Mon, Apr 17, 2017 at 5:30 AM, Gobinath <slgobin...@gmail.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> A prototype is implemented and available at [1]. Currently the >>>>>>>>> query support for absent patterns and two simple pattern >>>>>>>>> identifications (e1 >>>>>>>>> -> not e2 and not e1 -> e2) are implemented. Please have a look >>>>>>>>> at the unit test [2] to get the idea. Class names and variable names >>>>>>>>> are >>>>>>>>> subject to change (will finalize later). I am waiting for your >>>>>>>>> feedback. >>>>>>>>> >>>>>>>>> >>>>>>>>> Thanks & Regards, >>>>>>>>> Gobinath >>>>>>>>> >>>>>>>>> >>>>>>>>> [1] https://github.com/lgobinath/siddhi/tree/feature-absent- >>>>>>>>> event-pattern >>>>>>>>> [2] https://github.com/lgobinath/siddhi/blob/feature-absent- >>>>>>>>> event-pattern/modules/siddhi-core/src/test/java/org/wso2/sid >>>>>>>>> dhi/core/query/pattern/EveryAbsentPatternTestCase.java >>>>>>>>> >>>>>>>>> >>>>>>>>> On Fri, Mar 31, 2017 at 6:28 AM, Gobinath <slgobin...@gmail.com> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hi all, >>>>>>>>>> >>>>>>>>>> Thanks Suho for your feedback. I have made the changes based on >>>>>>>>>> your suggestions and submitted the final proposal. Started working >>>>>>>>>> on a >>>>>>>>>> prototype and will update you soon with the results. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Thanks & Regards, >>>>>>>>>> Gobinath >>>>>>>>>> >>>>>>>>>> On Thu, Mar 30, 2017 at 12:28 PM, Sriskandarajah Suhothayan < >>>>>>>>>> s...@wso2.com> wrote: >>>>>>>>>> >>>>>>>>>>> I have given some feedback on the gsoc site. >>>>>>>>>>> >>>>>>>>>>> Suho >>>>>>>>>>> >>>>>>>>>>> On Mon, Mar 27, 2017 at 9:03 PM, Gobinath <slgobin...@gmail.com> >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>>> Hi all, >>>>>>>>>>>> >>>>>>>>>>>> Thanks. I have shared the draft of my proposal titled >>>>>>>>>>>> "Non-Occurrence of Events for Siddhi Patterns" with WSO2 through >>>>>>>>>>>> GSoC >>>>>>>>>>>> dashboard and requesting your feedback on this. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Thanks & Regards, >>>>>>>>>>>> Gobinath >>>>>>>>>>>> >>>>>>>>>>>> On Wed, Mar 15, 2017 at 1:30 PM, Sriskandarajah Suhothayan < >>>>>>>>>>>> s...@wso2.com> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Thanks for the GSoC idea, I hope this will be a good way to >>>>>>>>>>>>> improve the Siddhi language and make it more powerfull. >>>>>>>>>>>>> If time permits we can also add other use-cases of patterns & >>>>>>>>>>>>> sequences and improve it further. >>>>>>>>>>>>> >>>>>>>>>>>>> Since you are still not a commuter I hope these contributions >>>>>>>>>>>>> will help you be a committer to Siddhi as well :) >>>>>>>>>>>>> I'll make this as a formal idea, do work on a proposal as >>>>>>>>>>>>> well. >>>>>>>>>>>>> >>>>>>>>>>>>> Regards >>>>>>>>>>>>> Suho >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On Wed, Mar 15, 2017 at 6:09 PM, Gobinath < >>>>>>>>>>>>> slgobin...@gmail.com> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> Hi team, >>>>>>>>>>>>>> >>>>>>>>>>>>>> This is Gobinath a former software engineer at WSO2 currently >>>>>>>>>>>>>> doing masters at Western University. This time I plan to do GSoC >>>>>>>>>>>>>> with WSO2 >>>>>>>>>>>>>> and this is the basic idea of what I have discussed with Suho. >>>>>>>>>>>>>> Based on Suho's suggestion, I come up with a proposal to >>>>>>>>>>>>>> implement detecting non-occurring events using Siddhi patterns. >>>>>>>>>>>>>> The current >>>>>>>>>>>>>> Siddhi patterns allow identifying the patterns that present. >>>>>>>>>>>>>> >>>>>>>>>>>>>> See an example: >>>>>>>>>>>>>> from every e1=Stream1[price>20] -> e2=Stream2[price>e1.price] >>>>>>>>>>>>>> within 1 sec >>>>>>>>>>>>>> select e1.symbol as symbol1, e2.symbol as symbol2 >>>>>>>>>>>>>> insert into OutputStream; >>>>>>>>>>>>>> >>>>>>>>>>>>>> Detecting the absence of a pattern is not natively supported >>>>>>>>>>>>>> by Siddhi patterns for the moment. In other words, identifying >>>>>>>>>>>>>> event_a not >>>>>>>>>>>>>> followed by event_b within 2 minutes is not possible using the >>>>>>>>>>>>>> current >>>>>>>>>>>>>> patterns implementation (Note that a time frame is required >>>>>>>>>>>>>> otherwise we >>>>>>>>>>>>>> have to wait for infinite time to say event_b has not arrived). >>>>>>>>>>>>>> The current >>>>>>>>>>>>>> workaround [1] to detect non-delivered items is shown below: >>>>>>>>>>>>>> >>>>>>>>>>>>>> from arrivals_stream#window.time(2 minutes) >>>>>>>>>>>>>> select * >>>>>>>>>>>>>> insert expired events into overdue_deliveries_stream; >>>>>>>>>>>>>> >>>>>>>>>>>>>> from every arrivalEvent = arrivals_stream -> >>>>>>>>>>>>>> deliveryEvent = deliveries_stream[arrivalEvent.trackingId == >>>>>>>>>>>>>> trackingId] >>>>>>>>>>>>>> or overdue_delivery = >>>>>>>>>>>>>> overdue_deliveries_stream[arrivalEvent.trackingId >>>>>>>>>>>>>> == trackingId] >>>>>>>>>>>>>> select arrivalEvent.trackingId as trackingId, >>>>>>>>>>>>>> arrivalEvent.customerName as customerName, >>>>>>>>>>>>>> arrivalEvent.telephoneNo as >>>>>>>>>>>>>> telephoneNo, deliveryEvent.trackingId as deliveryId >>>>>>>>>>>>>> insert into filter_stream; >>>>>>>>>>>>>> >>>>>>>>>>>>>> from filter_stream [ (deliveryId is null)] >>>>>>>>>>>>>> select trackingId, customerName, telephoneNo >>>>>>>>>>>>>> insert into alert_stream; >>>>>>>>>>>>>> >>>>>>>>>>>>>> This solution requires a time window and it is inefficient if >>>>>>>>>>>>>> we are interested only on one occurrence of such a pattern (In >>>>>>>>>>>>>> other words >>>>>>>>>>>>>> same query without every keyword). Further, the query is more >>>>>>>>>>>>>> complex and >>>>>>>>>>>>>> not user-friendly. >>>>>>>>>>>>>> >>>>>>>>>>>>>> If we provide patterns to detect absence of patterns, the >>>>>>>>>>>>>> above query can be rewritten as below: >>>>>>>>>>>>>> >>>>>>>>>>>>>> from every arrivalEvent = arrivals_stream -> (not >>>>>>>>>>>>>> deliveries_stream[arrivalEvent.trackingId == trackingId] >>>>>>>>>>>>>> within 2 min ) >>>>>>>>>>>>>> select arrivalEvent.trackingId as trackingId, >>>>>>>>>>>>>> arrivalEvent.customerName as customerName, >>>>>>>>>>>>>> arrivalEvent.telephoneNo as >>>>>>>>>>>>>> telephoneNo >>>>>>>>>>>>>> insert into alert_stream; >>>>>>>>>>>>>> >>>>>>>>>>>>>> As you can see, we can use the existing language components >>>>>>>>>>>>>> like not & within. This can be achieved by extending the existing >>>>>>>>>>>>>> StreamPreStateProcessors and StreamPostStateProcessors with an >>>>>>>>>>>>>> internal >>>>>>>>>>>>>> timer so that they can expire their internal list of events >>>>>>>>>>>>>> based on the >>>>>>>>>>>>>> time limit. It is somewhat similar to time windows but the >>>>>>>>>>>>>> processor can >>>>>>>>>>>>>> turn off the timer and ignore the events if it is a one time >>>>>>>>>>>>>> pattern >>>>>>>>>>>>>> detection. >>>>>>>>>>>>>> >>>>>>>>>>>>>> I hope it gives the basic idea and I am waiting for your >>>>>>>>>>>>>> suggestions and feedback. >>>>>>>>>>>>>> >>>>>>>>>>>>>> [1] https://docs.wso2.com/display/CEP400/Sample+0111+-+Detec >>>>>>>>>>>>>> ting+non-occurrences+with+Patterns >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thanks & Regards, >>>>>>>>>>>>>> Gobinath >>>>>>>>>>>>>> -- >>>>>>>>>>>>>> *Gobinath** Loganathan* >>>>>>>>>>>>>> Graduate Student, >>>>>>>>>>>>>> Electrical and Computer Engineering, >>>>>>>>>>>>>> Western University. >>>>>>>>>>>>>> Email : slgobin...@gmail.com >>>>>>>>>>>>>> Mobile : (+1) 416-895-0721 >>>>>>>>>>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> -- >>>>>>>>>>>>> >>>>>>>>>>>>> *S. Suhothayan* >>>>>>>>>>>>> Associate Director / Architect & Team Lead of WSO2 Complex >>>>>>>>>>>>> Event Processor >>>>>>>>>>>>> *WSO2 Inc. *http://wso2.com >>>>>>>>>>>>> * <http://wso2.com/>* >>>>>>>>>>>>> lean . enterprise . middleware >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> *cell: (+94) 779 756 757 <077%20975%206757> | blog: >>>>>>>>>>>>> http://suhothayan.blogspot.com/ >>>>>>>>>>>>> <http://suhothayan.blogspot.com/>twitter: >>>>>>>>>>>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | >>>>>>>>>>>>> linked-in: >>>>>>>>>>>>> http://lk.linkedin.com/in/suhothayan >>>>>>>>>>>>> <http://lk.linkedin.com/in/suhothayan>* >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> *Gobinath** Loganathan* >>>>>>>>>>>> Graduate Student, >>>>>>>>>>>> Electrical and Computer Engineering, >>>>>>>>>>>> Western University. >>>>>>>>>>>> Email : slgobin...@gmail.com >>>>>>>>>>>> Mobile : (+1) 416-895-0721 >>>>>>>>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> >>>>>>>>>>> *S. Suhothayan* >>>>>>>>>>> Associate Director / Architect >>>>>>>>>>> *WSO2 Inc. *http://wso2.com >>>>>>>>>>> * <http://wso2.com/>* >>>>>>>>>>> lean . enterprise . middleware >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> *cell: (+94) 779 756 757 <077%20975%206757> | blog: >>>>>>>>>>> http://suhothayan.blogspot.com/ >>>>>>>>>>> <http://suhothayan.blogspot.com/>twitter: >>>>>>>>>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | >>>>>>>>>>> linked-in: >>>>>>>>>>> http://lk.linkedin.com/in/suhothayan >>>>>>>>>>> <http://lk.linkedin.com/in/suhothayan>* >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> *Gobinath** Loganathan* >>>>>>>>>> Graduate Student, >>>>>>>>>> Electrical and Computer Engineering, >>>>>>>>>> Western University. >>>>>>>>>> Email : slgobin...@gmail.com >>>>>>>>>> Mobile : (+1) 416-895-0721 >>>>>>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> *Gobinath** Loganathan* >>>>>>>>> Graduate Student, >>>>>>>>> Electrical and Computer Engineering, >>>>>>>>> Western University. >>>>>>>>> Email : slgobin...@gmail.com >>>>>>>>> Mobile : (+1) 416-895-0721 >>>>>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> *S. Suhothayan* >>>>>>>> Associate Director / Architect >>>>>>>> *WSO2 Inc. *http://wso2.com >>>>>>>> * <http://wso2.com/>* >>>>>>>> lean . enterprise . middleware >>>>>>>> >>>>>>>> >>>>>>>> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog: >>>>>>>> http://suhothayan.blogspot.com/ >>>>>>>> <http://suhothayan.blogspot.com/>twitter: >>>>>>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | >>>>>>>> linked-in: >>>>>>>> http://lk.linkedin.com/in/suhothayan >>>>>>>> <http://lk.linkedin.com/in/suhothayan>* >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Gobinath** Loganathan* >>>>>>> Graduate Student, >>>>>>> Electrical and Computer Engineering, >>>>>>> Western University. >>>>>>> Email : slgobin...@gmail.com >>>>>>> Mobile : (+1) 416-895-0721 >>>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Gobinath** Loganathan* >>>>>> Graduate Student, >>>>>> Electrical and Computer Engineering, >>>>>> Western University. >>>>>> Email : slgobin...@gmail.com >>>>>> Mobile : (+1) 416-895-0721 >>>>>> Blog : javahelps.com <http://www.javahelps.com/> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> Dev@wso2.org >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Thanks & regards, >>>>> Nirmal >>>>> >>>>> Technical Lead, WSO2 Inc. >>>>> Mobile: +94715779733 <071%20577%209733> >>>>> Blog: http://nirmalfdo.blogspot.com/ >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> *S. Suhothayan* >>>> Associate Director / Architect >>>> *WSO2 Inc. *http://wso2.com >>>> * <http://wso2.com/>* >>>> lean . enterprise . middleware >>>> >>>> >>>> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog: >>>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter: >>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in: >>>> http://lk.linkedin.com/in/suhothayan >>>> <http://lk.linkedin.com/in/suhothayan>* >>>> >>> >>> >>> >>> -- >>> *Gobinath** Loganathan* >>> Graduate Student, >>> Electrical and Computer Engineering, >>> Western University. >>> Email : slgobin...@gmail.com >>> Mobile : (+1) 416-895-0721 >>> Blog : javahelps.com <http://www.javahelps.com/> >>> >>> >> >> >> >> -- >> *Gobinath** Loganathan* >> Graduate Student, >> Electrical and Computer Engineering, >> Western University. >> Email : slgobin...@gmail.com >> Mobile : (+1) 416-895-0721 >> Blog : javahelps.com <http://www.javahelps.com/> >> >> > > > > -- > > Thanks & regards, > Nirmal > > Technical Lead, WSO2 Inc. > Mobile: +94715779733 <071%20577%209733> > Blog: http://nirmalfdo.blogspot.com/ > > > -- *S. Suhothayan* Associate Director / Architect *WSO2 Inc. *http://wso2.com * <http://wso2.com/>* lean . enterprise . middleware *cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter: http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in: http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev