Hi Saneth, The reason for this is because, when you put a != , the join happens as follows. [image: Inline image 2]
This is why you get book1 and book2 once and book3, and book4 twice, in your RecommendationsOutputStream. You may have to use a count operator from the RecommendationsOutputStream to determine which books have not been bought. Seshika On Thu, Oct 16, 2014 at 12:29 PM, Rajeev Sampath <raje...@wso2.com> wrote: > Hi, > > On Thu, Oct 16, 2014 at 12:07 PM, Saneth Dharmakeerthi <sane...@wso2.com> > 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; > > > Thanks > Rajeev > > > >> >> Thanks and Best Regards, >> >> Saneth Dharmakeerthi >> Senior Software Engineer >> WSO2, Inc. >> Mobile: +94772325511 >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Rajeev Sampath > Senior Software Engineer > WSO2, Inc.; http://www.wso2.com. > > Mobile: > * +94716265766 <%2B94716265766>* > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev