You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Skollur <Sk...@idbny.com> on 2018/06/20 14:10:36 UTC

Apache Ignite Rest API JOIN with multiple Caches

Hello,


I have two objects i.e account and customer loaded to apache ignite server.
Both objects are loaded with data and each of them stored in its cache.
Account object/table is loaded to accountcache and customer object/table is
loaded to customercache. I am trying to access both the tables with join
using apache ignite rest api. I am unable to use join using rest-api-.2.5.0
version.

Cache Structure  and table/object
--------------------
CustomerCache -> customer
AccountCache-> account

Below Rest URL works for me.
a)
http://localhost:8080/ignite?cmd=qryfldexe&pageSize=1000&cacheName=CustomerCache&qry=select+id+from+customer

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

I would like to execute join on both CustomerCache.customer and
AccountCache.account. However I am unable to do so. Could you please provide
join cache/table example using apache ignite rest api?

I tried below
http://localhost:8080/ignite?cmd=qryfldexe&pageSize=1000&cacheName=CustomerCache&AccountCache&qry=select+id+from+Customer
c+join+
account a+on+where+c.id=a.id 

It throws an error  :    "error": "Table \"ACCOUNT\" not found; SQL
statement:\nselect id from




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Apache Ignite Rest API JOIN with multiple Caches

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

Try to use qryfldexe:

For example, I create next caches:

ss1.java
<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}

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Apache Ignite Rest API JOIN with multiple Caches

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

I will check it. Possible that something doesn't work as expected.

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Apache Ignite Rest API JOIN with multiple Caches

Posted by Skollur <Sk...@idbny.com>.
The above solution works fine with Ignite JDBC and however I am trying with
Ignite REST API. 

http://localhost:8080/ignite?cmd=qryfldexe&pageSize=100&cacheName=CustomerCache&qry=select+id+from+Customer
c+join+
AccountCache.account a+on+where+c.id=a.id

I am getting 
    "error": "Schema \"ACCOUNTCACHE\" not found; SQL statement:






--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Apache Ignite Rest API JOIN with multiple Caches

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

Question was answered in
https://stackoverflow.com/questions/50950480/join-on-apache-ignite-rest-api/50950777#50950777. 

BR,
Andrei





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/