If you use Strings as the keys you won’t get affinity collocation set up 
properly and distributed joins will return an incomplete result. One of the 
keys have to comprise a “parent” class key that will be an affinity key. Look 
at the example here:
https://apacheignite.readme.io/docs/affinity-collocation#section-collocate-data-with-data
 
<https://apacheignite.readme.io/docs/affinity-collocation#section-collocate-data-with-data>

As for the NON collocated joins suggested by Roger (qry.setDistributedJoins( 
true)), I would use them only if it’s impossible to set up the collocation 
between 2 entities. That’s not your case from what I see. NON collocated joins 
are slower than collocated ones.

—
Denis


> On Sep 1, 2017, at 2:53 PM, Roger Fischer (CW) <[email protected]> wrote:
> 
> Hi Matt,
> 
> are the objects to join collocated, ie. do they have the same affinity key? 
> If yes, it should work (it worked for me).
> 
> If no, you need to enable distributed joins for the query. See the middle 
> line.
> 
>            SqlFieldsQuery qry = new SqlFieldsQuery( stmt);
>            qry.setDistributedJoins( true);
>            queryCursor = aCache.query( qry);
> 
> Roger
> 
> -----Original Message-----
> From: matt [mailto:[email protected] <mailto:[email protected]>] 
> Sent: Friday, September 01, 2017 1:52 PM
> To: [email protected] <mailto:[email protected]>
> Subject: SQLQuery with simple Join return no results
> 
> I have 2 caches defined, both with String keys, and classes that make use of 
> the Ignite annotations for indexes and affinity. I've got 3 different nodes 
> running, and the code I'm using to populate the cache w/test data works, and 
> I can see each node is updated with its share of the data. My index types are 
> set on the caches as well.
> 
> If I do a ScanQuery, I can see that all of the fields and IDs are correct, 
> Ignite returns them all. But when doing a SqlQuery, I get nothing back.
> Ignite is not complaining about the query, it's just returning an empty 
> cursor.
> 
> If I remove the Join, results are returned.
> 
> So I'm wondering if this is related to the way I've set up my affinity 
> mapping. It's basically setup like the code below... and the query looks like 
> this:
> 
> "from B, A WHERE B.id = A.bID"
> 
> Any ideas on what I'm doing wrong here?
> 
> class A implements Serializable {
>  @QuerySqlField(index = true)
>  String id;
> 
>  @QuerySqlField(index = true)
>  String bId;  
> 
>  @AffinityKeyMapped
>  @QuerySqlField(index = true)
>  String group;
> }
> 
> class B implements Serializable {
>  @QuerySqlField(index = true)
>  String id;
> 
>  @AffinityKeyMapped
>  @QuerySqlField(index = true)
>  String group;
> }
> 
> 
> 
> --
> Sent from: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__apache-2Dignite-2Dusers.70518.x6.nabble.com_&d=DwICAg&c=IL_XqQWOjubgfqINi2jTzg&r=1esZO0r0bYS90lcsaLA6N4AFxuNo6lzauhETGwdJQoQ&m=g9B7o3WZd7LuW39MRFWdU5Gim1S3DRPZGcugI0n9Wno&s=ehBogkdblpG8U9N0taPx5Jdf8G9uDMnZiRR-f34rEe0&e=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__apache-2Dignite-2Dusers.70518.x6.nabble.com_&d=DwICAg&c=IL_XqQWOjubgfqINi2jTzg&r=1esZO0r0bYS90lcsaLA6N4AFxuNo6lzauhETGwdJQoQ&m=g9B7o3WZd7LuW39MRFWdU5Gim1S3DRPZGcugI0n9Wno&s=ehBogkdblpG8U9N0taPx5Jdf8G9uDMnZiRR-f34rEe0&e=>

Reply via email to