Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
Hi Evgenii, Are you saying that if the affinityKey column is present in WHERE clause of SQL statement, the SQL engine will detect a node where this key is placed and execute this query only on one node. I just want to make sure that SQL gets executed only on node where the affinity key is placed. I was trying to achieve this by enclosing the SQL in a closure and executing this closure using affinityCall. Thanks, Prasad On Wed, Jul 25, 2018 at 4:02 PM Ilya Kasnacheev wrote: > Hello! > > I hope that Ignite statement planner will make use of affinity key if you > provide it in the request. I.e. it will not be broadcast if you provide > affinity key. > > Regards, > > -- > Ilya Kasnacheev > > 2018-07-25 10:58 GMT+03:00 Stanislav Lukyanov : > >> What do you mean by “execute select query on cache using affinity key” >> >> and what is the problem you’re trying to solve? >> >> >> >> Stan >> >> >> >> *From: *Prasad Bhalerao >> *Sent: *25 июля 2018 г. 10:03 >> *To: *user@ignite.apache.org >> *Subject: UNCHECKED*** Executing SQL on cache using affinnity key >> >> >> >> Hi, >> >> >> >> Is there any way to execute select query on cache using affinity key? >> >> >> >> As per this link: >> https://apacheignite.readme.io/docs/collocate-compute-and-data#section-affinity-call-and-run-methods >> >> >> >> It can be done as follows: >> >> >> >> compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { >> >> SqlFieldsQuery sqlFieldsQuery = *new >> *SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); >> sqlFieldsQuery.setDistributedJoins(*false*); >> sqlFieldsQuery.setLocal(*true*); >> sqlFieldsQuery.setCollocated(*true*); >> *return *cache().query(sqlFieldsQuery); >> }); >> >> Is there any other way to do it? >> >> >> >> Thanks, >> >> Prasad >> >> >> > >
RE: ***UNCHECKED*** Executing SQL on cache using affinnity key
Yes, that’s exactly how Ignite SQL works by default. Stan From: Prasad Bhalerao Sent: 25 июля 2018 г. 15:35 To: user@ignite.apache.org Subject: Re: ***UNCHECKED*** Executing SQL on cache using affinnity key I want to get the data from multiple caches using SELECT query from client node. The affinity key for all the caches is same. Since I know that the data in all caches is collocated, I just want make sure that sql gets executed only on one of the node(which is primary or secondary for that data) and not on all nodes. The way we submit the tasks using affinity key, can we submit the sql using a affinity key so that it gets executed only on a node which owns that data? Thanks, Prasad On Wed, Jul 25, 2018 at 3:01 PM Stanislav Lukyanov wrote: What do you mean by “execute select query on cache using affinity key” and what is the problem you’re trying to solve? Stan From: Prasad Bhalerao Sent: 25 июля 2018 г. 10:03 To: user@ignite.apache.org Subject: ***UNCHECKED*** Executing SQL on cache using affinnity key Hi, Is there any way to execute select query on cache using affinity key? As per this link: https://apacheignite.readme.io/docs/collocate-compute-and-data#section-affinity-call-and-run-methods It can be done as follows: compute.affinityCall(CACHE_NAME, affinityKey, () -> { SqlFieldsQuery sqlFieldsQuery = new SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); sqlFieldsQuery.setDistributedJoins(false); sqlFieldsQuery.setLocal(true); sqlFieldsQuery.setCollocated(true); return cache().query(sqlFieldsQuery); }); Is there any other way to do it? Thanks, Prasad
Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
Are you saying that if the affinityKey is present in WHERE clause of SQL statement, the SQL engine will detect a node where this key is placed and execute this query only on one node. I just want to make sure that SQL gets executed only on node where the affinity key is placed. I was trying to achieve this by enclosing the SQL in a closure and executing this closure using affinityCall. Thanks, Prasad On Wed, Jul 25, 2018 at 3:51 PM Evgenii Zhuravlev wrote: > When you run SQL query with filtering on Affinity key field, the SQL > engine will detect a node where this key is placed and execute this query > only on one node. > > What are you trying to achieve? > > Evgenii > > 2018-07-25 10:00 GMT+03:00 Prasad Bhalerao : > >> Hi, >> >> Is there any way to execute select query on cache using affinity key? >> >> As per this link: >> https://apacheignite.readme.io/docs/collocate-compute-and-data#section-affinity-call-and-run-methods >> >> It can be done as follows: >> >> compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { >> >> SqlFieldsQuery sqlFieldsQuery = new >> SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); >> sqlFieldsQuery.setDistributedJoins(false); >> sqlFieldsQuery.setLocal(true); >> sqlFieldsQuery.setCollocated(true); >> return cache().query(sqlFieldsQuery); >> }); >> >> Is there any other way to do it? >> >> Thanks, >> Prasad >> > >
Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
I want to get the data from multiple caches using SELECT query from client node. The affinity key for all the caches is same. Since I know that the data in all caches is collocated, I just want make sure that sql gets executed only on one of the node(which is primary or secondary for that data) and not *on all nodes.* The way we submit the tasks using affinity key, can we submit the sql using a affinity key so that it gets executed only on a node which owns that data? Thanks, Prasad On Wed, Jul 25, 2018 at 3:01 PM Stanislav Lukyanov wrote: > What do you mean by “execute select query on cache using affinity key” > > and what is the problem you’re trying to solve? > > > > Stan > > > > *From: *Prasad Bhalerao > *Sent: *25 июля 2018 г. 10:03 > *To: *user@ignite.apache.org > *Subject: UNCHECKED*** Executing SQL on cache using affinnity key > > > > Hi, > > > > Is there any way to execute select query on cache using affinity key? > > > > As per this link: > https://apacheignite.readme.io/docs/collocate-compute-and-data#section-affinity-call-and-run-methods > > > > It can be done as follows: > > > > compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { > > SqlFieldsQuery sqlFieldsQuery = *new > *SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); > sqlFieldsQuery.setDistributedJoins(*false*); > sqlFieldsQuery.setLocal(*true*); > sqlFieldsQuery.setCollocated(*true*); > *return *cache().query(sqlFieldsQuery); > }); > > Is there any other way to do it? > > > > Thanks, > > Prasad > > >
Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
Hi Evgenii, Are you saying that if the affinityKey column is present in WHERE clause of SQL statement, the SQL engine will detect a node where this key is placed and execute this query only on one node. I just want to make sure that SQL gets executed only on node where the affinity key is placed. Thanks, Akash On Wed, Jul 25, 2018 at 3:45 PM, Ilya Kasnacheev wrote: > Hello! > > I hope that Ignite statement planner will make use of affinity key if you > provide it in the request. I.e. it will not be broadcast if you provide > affinity key. > > Regards, > > -- > Ilya Kasnacheev > > 2018-07-25 10:58 GMT+03:00 Stanislav Lukyanov : > >> What do you mean by “execute select query on cache using affinity key” >> >> and what is the problem you’re trying to solve? >> >> >> >> Stan >> >> >> >> *From: *Prasad Bhalerao >> *Sent: *25 июля 2018 г. 10:03 >> *To: *user@ignite.apache.org >> *Subject: UNCHECKED*** Executing SQL on cache using affinnity key >> >> >> >> Hi, >> >> >> >> Is there any way to execute select query on cache using affinity key? >> >> >> >> As per this link: https://apacheignite.readme.io/docs/collocate-compute- >> and-data#section-affinity-call-and-run-methods >> >> >> >> It can be done as follows: >> >> >> >> compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { >> >> SqlFieldsQuery sqlFieldsQuery = *new >> *SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); >> sqlFieldsQuery.setDistributedJoins(*false*); >> sqlFieldsQuery.setLocal(*true*); >> sqlFieldsQuery.setCollocated(*true*); >> *return *cache().query(sqlFieldsQuery); >> }); >> >> Is there any other way to do it? >> >> >> >> Thanks, >> >> Prasad >> >> >> > >
Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
Hello! I hope that Ignite statement planner will make use of affinity key if you provide it in the request. I.e. it will not be broadcast if you provide affinity key. Regards, -- Ilya Kasnacheev 2018-07-25 10:58 GMT+03:00 Stanislav Lukyanov : > What do you mean by “execute select query on cache using affinity key” > > and what is the problem you’re trying to solve? > > > > Stan > > > > *From: *Prasad Bhalerao > *Sent: *25 июля 2018 г. 10:03 > *To: *user@ignite.apache.org > *Subject: UNCHECKED*** Executing SQL on cache using affinnity key > > > > Hi, > > > > Is there any way to execute select query on cache using affinity key? > > > > As per this link: https://apacheignite.readme.io/docs/collocate- > compute-and-data#section-affinity-call-and-run-methods > > > > It can be done as follows: > > > > compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { > > SqlFieldsQuery sqlFieldsQuery = *new > *SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); > sqlFieldsQuery.setDistributedJoins(*false*); > sqlFieldsQuery.setLocal(*true*); > sqlFieldsQuery.setCollocated(*true*); > *return *cache().query(sqlFieldsQuery); > }); > > Is there any other way to do it? > > > > Thanks, > > Prasad > > >
Re: ***UNCHECKED*** Executing SQL on cache using affinnity key
When you run SQL query with filtering on Affinity key field, the SQL engine will detect a node where this key is placed and execute this query only on one node. What are you trying to achieve? Evgenii 2018-07-25 10:00 GMT+03:00 Prasad Bhalerao : > Hi, > > Is there any way to execute select query on cache using affinity key? > > As per this link: https://apacheignite.readme.io/docs/collocate- > compute-and-data#section-affinity-call-and-run-methods > > It can be done as follows: > > compute.affinityCall(*CACHE_NAME*, *affinityKey*, () -> { > > SqlFieldsQuery sqlFieldsQuery = new > SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); > sqlFieldsQuery.setDistributedJoins(false); > sqlFieldsQuery.setLocal(true); > sqlFieldsQuery.setCollocated(true); > return cache().query(sqlFieldsQuery); > }); > > Is there any other way to do it? > > Thanks, > Prasad >
RE: ***UNCHECKED*** Executing SQL on cache using affinnity key
What do you mean by “execute select query on cache using affinity key” and what is the problem you’re trying to solve? Stan From: Prasad Bhalerao Sent: 25 июля 2018 г. 10:03 To: user@ignite.apache.org Subject: ***UNCHECKED*** Executing SQL on cache using affinnity key Hi, Is there any way to execute select query on cache using affinity key? As per this link: https://apacheignite.readme.io/docs/collocate-compute-and-data#section-affinity-call-and-run-methods It can be done as follows: compute.affinityCall(CACHE_NAME, affinityKey, () -> { SqlFieldsQuery sqlFieldsQuery = new SqlFieldsQuery(SELECT_STATEMENT).setArgs(args); sqlFieldsQuery.setDistributedJoins(false); sqlFieldsQuery.setLocal(true); sqlFieldsQuery.setCollocated(true); return cache().query(sqlFieldsQuery); }); Is there any other way to do it? Thanks, Prasad