On Thu, Oct 16, 2014 at 12:29 PM, Rajeev Sampath <[email protected]> wrote:

> Hi,
>
> On Thu, Oct 16, 2014 at 12:07 PM, Saneth Dharmakeerthi <[email protected]>
> wrote:
>
>> Hi,
>>
>> I am writing a Siddhi query to get the un-purchased books from an  event
>> table that has all  the books and a stream that contains  the already
>> bought books.
>>
>> my quarry is like  this;
>>
>> *userboughtbooks: *Stream that contains  the already bought books
>> *bookGroupTable: *Table that has all  the books
>> *RecommendationsOutputDataStream: *Out  put stream that contains  all
>> un-purchased books.
>>
>> from userboughtbooks#window.time(10 min) join bookGroupTable
>> on  bookGroupTable.book_id  != userboughtbooks.book_id
>> select bookGroupTable.book_id
>> insert into RecommendationsOutputDataStream
>>
>> 1. when  userboughtbooks has one element it gives the correct result.
>>
>> userboughtbooks: book1
>> bookGroupTable: book1, book2, book3, book4
>> RecommendationsOutputDataStream: book2, book3, book4
>>
>> 2. but  userboughtbooks has more than one element  gives the out put like
>> follows
>>
>> userboughtbooks: book1, book2
>> bookGroupTable: book1, book2, book3, book4
>> RecommendationsOutputDataStream: book1,book2,book3,book3,book4,book4
>>
>> I think behaviour of [2] , because of joining with  more than one element.
>>
>> Is there a recommended way to accomplish this task?
>>
>>
>>
> As a workaround to solve this, you can add another query to check whether
> each output of recommendations stream exists in the table and then output
> only the non existing ones.
>
> eg:
>
> from RecommendationsOutputDataStream [not ((book_id ==
> bookGroupTable.book_id ) in bookGroupTable)]
> select *
> insert into filteredRecommendationsStream;
>
>
> Seems this won't work unless this is done against another table that has
the user brought books


Thanks
Rajeev



> Thanks
> Rajeev
>
>
>
>>
>> Thanks and Best Regards,
>>
>> Saneth Dharmakeerthi
>> Senior Software Engineer
>> WSO2, Inc.
>> Mobile: +94772325511
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Rajeev Sampath
> Senior Software Engineer
> WSO2, Inc.; http://www.wso2.com.
>
> Mobile:
> * +94716265766 <%2B94716265766>*
>



-- 
Rajeev Sampath
Senior Software Engineer
WSO2, Inc.; http://www.wso2.com.

Mobile:
* +94716265766*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to