Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-27 Thread vkulichenko
I actually don't think it relates to initial query, although it definitely
guarantees exactly-once for listener updates. Andrew, am I wrong?

-Val



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-27 Thread Andrey Mashenkov
Hi,

Continuous query guarantees exactly once delivery [1].
Duplicate events are rejected by cont.query internals.

[1]
https://apacheignite.readme.io/docs/continuous-queries#section-events-delivery-guarantees

On Mon, Mar 26, 2018 at 8:02 PM, au.fp2018  wrote:

> Cool thanks for the confirmation
> Just curious does the continuous query implementation handle the
> duplicates?
> i.e. is the client code shielded from having to deal with duplicates?
>
>
> vkulichenko wrote
> > This makes sense, and actually that's exactly how initialQuery works.
> It's
> > executed after continuous query listener is deployed, so nothing is
> > missed,
> > but duplicates are possible.
> >
> > -Val
> >
> >
> >
> > --
> > Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-26 Thread au.fp2018
Cool thanks for the confirmation
Just curious does the continuous query implementation handle the duplicates?
i.e. is the client code shielded from having to deal with duplicates?


vkulichenko wrote
> This makes sense, and actually that's exactly how initialQuery works. It's
> executed after continuous query listener is deployed, so nothing is
> missed,
> but duplicates are possible.
> 
> -Val
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-25 Thread vkulichenko
This makes sense, and actually that's exactly how initialQuery works. It's
executed after continuous query listener is deployed, so nothing is missed,
but duplicates are possible.

-Val



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-23 Thread au.fp2018
The way I plan on working around it is by first running the ContinuousQuery
and then the SqlFieldsQuery, wait for the results from the SqlFieldsQuery
(while caching any updates from the ContinuousQuery). 

When the SqlFieldsQuery results arrive deal with any duplicates and them
proceed with streaming out the snapshot followed by the updates. Or let the
downstream system deal with the duplicates since each message has a unique
ID and timestamp.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-23 Thread Pavel Vinokurov
This approach makes sense. I don't see any downside except a case when you
put some data in a cache after execution of the SqlFieldsQuery and before
ContinuousQuery.

2018-03-22 18:40 GMT+03:00 au.fp2018 :

> Thanks Pavel
>
> I was able to get a Java version of the query client implemented using your
> suggestions. But I am having a hard time convincing the scala compiler to
> type check. Even if I get it to work the amount of type coercing I would
> need to get it to work is extremely hairy.
>
> Before your reply I had given up on the possibility of using SqlFieldsQuery
> as the initialQuery and ended up making the snapshot query as a regular
> SqlFieldsQuery and then issue a ContinuousQuery (with no initial query) to
> receive updates.
>
> Is there any downside to this approach?
>
> Thanks,
> Andre
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-22 Thread Pavel Vinokurov
Hi,

Yes, continuous queries are only predicate based and could named as "continuous
listener", but for an initial query that run once we could use
SQLFieldsQuery.
Let try with following code:
ContinuousQuery q= new ContinuousQuery();
((ContinuousQuery)q).setInitialQuery(new SqlFieldsQuery("select _val from
table"));
q.setLocalListener(System.out::println);
QueryCursor cursor = binaryCache.query(q);
cursor.forEach(o -> {
   SomeValue v = (SomeValue) o;
});

Thanks,
Pavel

2018-03-21 17:44 GMT+03:00 au.fp2018 :

> Thanks for your answer Pavel.
>
> But that does not help. 'q' is already a ContinuousQuery am I not sure what
> good the additional cast does. Anyway I tried that and also explicitly
> casting the initialQuery, didn't work. As I was suggesting in my first post
> the types don't line-up.
>
> In my search I came across this on Stack Overflow:
> https://stackoverflow.com/a/43076601
>
> According to that reply "Continuous queries are only predicate based, SQL
> is
> not supported here.". But the documentation says SQL is supported. This is
> very confusing and misleading.
>
> If only predicate based queries are supported than how can one take
> advantage of the indexes in Ignite.
> I would prefer SCAN queries, but without indexes my initial query is
> unacceptably slow.
>
> Thanks in Advance.
>
> Thanks,
> Andre
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-21 Thread au.fp2018
Thanks for your answer Pavel.

But that does not help. 'q' is already a ContinuousQuery am I not sure what
good the additional cast does. Anyway I tried that and also explicitly
casting the initialQuery, didn't work. As I was suggesting in my first post
the types don't line-up.

In my search I came across this on Stack Overflow:
https://stackoverflow.com/a/43076601

According to that reply "Continuous queries are only predicate based, SQL is
not supported here.". But the documentation says SQL is supported. This is
very confusing and misleading.

If only predicate based queries are supported than how can one take
advantage of the indexes in Ignite. 
I would prefer SCAN queries, but without indexes my initial query is
unacceptably slow.

Thanks in Advance.

Thanks,
Andre




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-20 Thread Vinokurov Pavel
Hello!

At the compilation time it is impossible to know result type of the
SqlFieldsQuery.
So you can try following:
((ContinuousQuery)q).setInitialQuery(new SqlFieldsQuery("select _val from
table"));

Thanks,
Pavel

2018-03-20 20:43 GMT+03:00 au.fp2018 :

> Hello All,
>
> I'm trying to setup a ContinuousQuery to retrieve _VAL objects from the
> cache. So I tried using the SqlQuery but unfortunately I get the following
> error:
>
> Only queries starting with 'SELECT *' and 'SELECT alias.*' are
> supported
> (rewrite your query or use SqlFieldsQuery instead): select _VAL from
> "test"."TEST" where test_id=?
>
> If I convert the query to SqlFieldsQuery then the return type does not
> match
> the type expected by the setInitalQuery() method:
>
> contQuery.setInitialQuery(initQueryUsingSqlFieldsQuery);// <--
> doesn't compile
>
> Is there an example of using SqlFieldsQuery as the InitialQuery?
> How else can I retrieve the initial snapshot using SQL, when I need the
> fully deserialzed _VAL object?
>
> Thanks,
> AU
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov


ContinuousQuery - SqlFieldsQuery as InitialQuery

2018-03-20 Thread au.fp2018
Hello All,

I'm trying to setup a ContinuousQuery to retrieve _VAL objects from the
cache. So I tried using the SqlQuery but unfortunately I get the following
error:

Only queries starting with 'SELECT *' and 'SELECT alias.*' are supported 
(rewrite your query or use SqlFieldsQuery instead): select _VAL from
"test"."TEST" where test_id=?

If I convert the query to SqlFieldsQuery then the return type does not match
the type expected by the setInitalQuery() method:

contQuery.setInitialQuery(initQueryUsingSqlFieldsQuery);// <--
doesn't compile 

Is there an example of using SqlFieldsQuery as the InitialQuery?
How else can I retrieve the initial snapshot using SQL, when I need the
fully deserialzed _VAL object?

Thanks,
AU




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/