Hi Aneela,

As Charini mentioned above this is the expected output as for your query. There
will be an output for each and every incoming event since you haven't
included any window for your intermediateStream. But you can get your
expected output by adding a batch window[1] to your query. As an example if
you knew the event count you can simply add a lengthBatch[2] window as
below,

from intermediateStream#window.lengthBatch(3)
select ts, count(ts) as ssh_logins
group by ts
insert into SSHOutStream;

Then it will hold events as a batch of 3 events and return an output as below,

        ts         ssh_logins
2016-05-08 08:59       1
2016-05-08 09:00       2

Similarly you can use other windows such as timeBatch, cron etc. as for
your requirment.

[1]https://docs.wso2.com/display/CEP410/SiddhiQL+Guide+3.0#SiddhiQLGuide3.0-InbuiltWindows
[2]https://docs.wso2.com/display/CEP410/Inbuilt+Windows#InbuiltWindows-lengthBatch


Best regards,
Ashen


On Wed, Jun 22, 2016 at 5:00 PM, Charini Nanayakkara <chari...@wso2.com>
wrote:

> Hi Aneela,
>
> The siddhi query you have specified processes each and every incoming
> event. Since processing is done in real time, when the first event for ts= 
> 2016-05-08
> 09:00 arrives it gives count = 1 (due to no events with ts = 2016-05-08
> 09:00 having arrived earlier). When second event with ts = 2016-05-08
> 09:00 comes, we get count as 2 since an event with same ts arrived earlier
> as well.
>
> Best Regards,
> Charini
>
> On Wed, Jun 22, 2016 at 4:40 PM, Aneela Safdar <ansaf_...@yahoo.com>
> wrote:
>
>> Hi all,
>>
>> I am having a trouble in digesting results of my group by query. My
>> source stream named intermediateStream has data
>>
>>      ts                       uid             id_resp_h
>> 2016-05-08 08:59      CLuCgz3HHzG7LpLwH9    172.30.26.119
>> 2016-05-08 09:00      C3WnnK3TgUf2cSzxVa    172.30.26.127
>> 2016-05-08 09:00      C3WnnK3TgUf2cSzxff    172.30.26.119
>>
>> SIDDHI query is
>>
>> from intermediateStream
>> select ts, count(ts) as ssh_logins
>> group by ts
>> insert into SSHOutStream;
>>
>> I am expecting output to be like
>>
>>         ts         ssh_logins
>> 2016-05-08 08:59       1
>> 2016-05-08 09:00       2
>>
>> But instead it returns
>>
>>         ts         ssh_logins
>> 2016-05-08 08:59       1
>> 2016-05-08 09:00       1
>> 2016-05-08 09:00       2
>>
>> Any suggestions?
>>
>> Regards, Aneela Safdar
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Charini Vimansha Nanayakkara
> Software Engineer at WSO2
> Mobile: 0714126293
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Ashen Weerathunga*
Software Engineer
WSO2 Inc.: http://wso2.com
lean.enterprise.middleware

Email: as...@wso2.com
Mobile: +94 716042995 <94716042995>
LinkedIn: *http://lk.linkedin.com/in/ashenweerathunga
<http://lk.linkedin.com/in/ashenweerathunga>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to