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

Reply via email to