Search code examples
javaignite

Readthrough does not work with ignite SQL queries from rest apis and as only one cacheName can be passed then how to run Cross-Cache join query f?


I have the use case where I will be querying ignite cache with rest apis using SQL queries. I need to sort, join etc.

I have setup the JdbcCacheStore and if I load data using cache.loadCache(null), everything works. I am able to query using rest apis.

http://host:port/ignite?cmd=qryfldexe&pageSize=10&cacheName=Person&qry=select+firstName%2C+lastName+from+Person

I don't want to load cache when ignite is started. I want it to be populated (readthrough) if cache is not present. If I use, get rest api readthrough works.

http://host:port/ignite?cmd=get&key=getKey&cacheName=partionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647

But I will be querying using "Sql fields query execute"

http://apacheignite.gridgain.org/docs/rest-api#sql-fields-query-execute

When I tried querying using it http://host:port/ignite?cmd=qryfldexe&pageSize=10&cacheName=Person&qry=select+firstName%2C+lastName+from+Person, readthrough did not work. Cache did not populate.

Also, as the rest api allows to pass only one cacheName, how to run join queries?


Solution

  • Read-through for queries is not supported because for read-through you need to know set of keys to load in advance, which is not possible with SQL. For SQL you need to load all required data into memory in advance.