问题
How is spatial join query executed among the nodes in PARTITIONED mode? As Ignite partition the data (default 1024) among the nodes using Rendezvous Affinity hashing, how is join operation executed among the partitions? Suppose I have two spatial datasets in the cache (pCache and qCache), each contains 10 partitions(1, .., 10). How is ignite perform the join operation on this two dataset? Is it partition1 of pCache with partition1 of qCache?
My second question: How is ignite perform the same operation in case of distributed join?
回答1:
There is no correspondence between partitions of different caches. If you run a join operation, then by default only local lookup will be performed.If data is not collocated, then this approach may give you a partial result.
When all-to-all mapping is performed, then every node has to communicate with every other node, so
The recommended way to do joins is to collocate the data in a way, that no distributed joins are needed. Ignite has a feature called affinity collocation, designed specially for this purpose. You can specify a field of an object, that will be used to calculate the affinity function. Value of this field doesn't have to be unique, but it should be a part of a key. So, if you want to perform joins on two tables, you may collocate them by affinity, so no distributed joins will be needed.
来源:https://stackoverflow.com/questions/52602842/join-query-in-apache-ignite