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 <e.zhuravlev...@gmail.com> 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 <prasadbhalerao1...@gmail.com>: > >> 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 >> > >