1
votes

Does anyone know if you can do a join using the REST API for Apache Ignite? I have two objects, account and customer loaded to the Apache Ignite Server. Both objects are loaded with data and stored in the cache as account object cache and customer object cache. I am able to query both objects separately using the REST API, i.e.

http://localhost:8080/ignite?cmd=qryfldexe&pageSize=1000&cacheName=CustomerCache&qry=select+id+from+customer

http://localhost:8080/ignite?cmd=qryfldexe&pageSize=1000&cacheName=AccountCache&qry=select+id+from+account

However, I would like to execute a join on the account and customer cache. Is this supported and if so, does anyone have any examples? I can't find any documentation on this.

2

2 Answers

0
votes

You need to specify one cache in the cacheName, and reference the second table in the JOIN via its schema name (by default it's the cache name). That's not unique to the REST API, Java API works in the same way. The query should be something like

SELECT * 
FROM Customer AS c
JOIN AccountCache.Account AS a
WHERE c.id = a.customerId
0
votes

Try to use qryfldexe:

For example, I create next caches:

http://apache-ignite-users.70518.x6.nabble.com/file/t1704/ss1.java

It creates two caches with the same structure.

Now I am going to execute next command:

SELECT * FROM "mycache1".Value V1 join "mycache2".Value V2 on V1.key=V2.key

Let's use next converter to get URI string:

https://meyerweb.com/eric/tools/dencoder/

Our command will be next:

SELECT%20*%20FROM%20%22mycache1%22.Value%20V1%20join%20%22mycache2%22.Value%20V2%20on%20V1.key%3DV2.key

Run next in brouser:

http://127.0.0.1:8080/ignite?cmd=qryfldexe&pageSize=10&cacheName=mycache1&qry=SELECT%20*%20FROM%20%22mycache1%22.Value%20V1%20join%20%22mycache2%22.Value%20V2%20on%20V1.key%3DV2.key

Output:

{"successStatus":0,"error":null,"response":{"items":[[0,"Value 0",0,"Value 
0"],[1,"Value 1",1,"Value 1"],[2,"Value 2",2,"Value 2"],[3,"Value 
3",3,"Value 3"],[4,"Value 4",4,"Value 4"],[5,"Value 5",5,"Value 
5"],[6,"Value 6",6,"Value 6"],[7,"Value 7",7,"Value 7"],[8,"Value 
8",8,"Value 8"],[9,"Value 9",9,"Value 
9"]],"last":false,"queryId":10,"fieldsMetadata":[{"schemaName":"mycache1","typeName":"VALUE","fieldName":"KEY","fieldTypeName":"java.lang.Integer"},{"schemaName":"mycache1","typeName":"VALUE","fieldName":"VALUE","fieldTypeName":"java.lang.String"},{"schemaName":"mycache2","typeName":"VALUE","fieldName":"KEY","fieldTypeName":"java.lang.Integer"},{"schemaName":"mycache2","typeName":"VALUE","fieldName":"VALUE","fieldTypeName":"java.lang.String"}]},"sessionToken":null}