ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger Fischer (CW)" <rfis...@Brocade.com>
Subject RE: SQLQuery with simple Join return no results
Date Fri, 01 Sep 2017 21:53:32 GMT
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:goodieboy@gmail.com] 
Sent: Friday, September 01, 2017 1:52 PM
To: user@ignite.apache.org
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=


Mime
View raw message