Re: How to query to local partition cache data
My answer of question describes below code. Q. How can I query only the data held by Ignite data nodes? A. First, Ignite AffinityFunction is used to send the desired data to one node with partition 1. And, if you are guaranteed to be assigned to 1 partition, use the code below. Use Ignite AffinityRun | affinityCall to assign compute task to partition 1 node. The node then assigns a partition to the setPartitions method to query only the partitions it is responsible for. This part is described in the code below. https://github.com/gridgain/gridgain-advanced-examples/blob/master/src/main/java/org/gridgain/examples/datagrid/query/ScanQueryExample.java @Andrew MashenkovReply Thanks for your kind reply again. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to query to local partition cache data
Below is the best way to do a query based on local data I want. Is this part right? When we do affinityCall, we specify partition 1 and the query is also set to 1. SqlFieldsQuery query = new SqlFieldsQuery ("select sum (count) from data group by id") setPartitions (1); Even if we have a backup, is it only based on ignite partition 1 node own data? -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to query to local partition cache data
Hi, Thanks for kind of reply. But, I test each query option. setLocal - In my opinion, it seemed that all the nodes were performing on the query. What I wanted to do was that the node responsible for the affinityRun key query only the data. However, as described above, it seemed to load all nodes. setCollocated - This part seems to mean that the node requested by affinityRun becomes the Reducer Node and that the query is specified to have Group By on each node when generating the Map query. In other words, if you do not use this option, it is understood that the requesting node will ask all nodes for a row, and if they receive all of them, it will perform a Group By query on their own. Is this part right? setDistributedJoins - I have not tested this part. We are not using Join. I understood what you explained. Thank you for your kind explanation. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to query to local partition cache data
Hi, setLocal - if true then query will be executed on local data node only. setCollocated - if true then rows are collocated on GROUP BY field and Ignite can evaluate aggregate functions on Map step. setDistributedJoins - if true then Ignite will try to join rows with rows on other nodes. Would you please clarify what and how you observe the weird things? BTW: In first case, affinityRun makes task to be executed on node that is primary to Key given, but local SQL query will run on all primary data on available on local node. In second case, using setPartition restrict SQL query with given Partition and a Key can be non-affinity key for this partition. So, here task can be run on node that is primary for Key=1, but make a remote query to node that is primary to partition=1. On Sun, Oct 22, 2017 at 11:53 AM, darkwrote: > Result of the document > > setLocal is a local query > setCollocated specifies that the data associated with Cache's Join function > is local > > It seems like this. > But why does the Partitioned Cache increase the GridQueryExecutor's Task on > all nodes? > > Thank you. > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ > -- Best regards, Andrey V. Mashenkov
Re: How to query to local partition cache data
Result of the document setLocal is a local query setCollocated specifies that the data associated with Cache's Join function is local It seems like this. But why does the Partitioned Cache increase the GridQueryExecutor's Task on all nodes? Thank you. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to query to local partition cache data
In addition, I am confused about exactly what each of the following setting values that can be set in SqlFieldsQuery means. setLocal setCollocated Can you explain the meaning of these by taking an example? -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
How to query to local partition cache data
How can I query only the data held by ignite data nodes? I've used it like this, but I've confirmed that the CompletedTaskCount of the GridQueryExecutor of other nodes goes up. ignite.compute().affinityRun(cacheName, 1, () -> { Ignite ignite = Ignition.ignite(); IgniteCache cache = ignite.cache(cacheName); SqlFieldsQuery query = new SqlFieldsQuery("select path, sum(count) from CacheTable group by path").setLocal(true); long queryStartTimeMillis = System.currentTimeMillis(); List all = cache.query(query).getAll(); }); I think that when I query like above, Compute Task is delivered to the node that is in charge of 1 partition key and queries about the partitions that it is responsible for. However, the CompletedTaskCount of the GridQueryExecutor on all nodes has been increased. :( ignite.compute().affinityRun(cacheName, 1, () -> { Ignite ignite = Ignition.ignite(); IgniteCache cache = ignite.cache(cacheName); SqlFieldsQuery query = new SqlFieldsQuery("select path, sum(count) from CacheTable group by path").setPartitions(1); long queryStartTimeMillis = System.currentTimeMillis(); List all = cache.query(query).getAll(); }); when I query like above, Only the node in charge of the partition has confirmed that the CompletedTaskCount of the GridQueryExecutor increases. How can I force the Data node to query with its own data? -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/