"Read-through" implementation for sql query

classic Classic list List threaded Threaded
6 messages Options
Andrey Nestrogaev Andrey Nestrogaev
Reply | Threaded
Open this post in threaded view
|

"Read-through" implementation for sql query

Hi All,

Can somebody explain how the mode "Read-through" works if I execute the query(below) suppose twice?
Assume that initially the cache is empty.
The sql query is: select name from person where name like "t*"
alexey.goncharuk alexey.goncharuk
Reply | Threaded
Open this post in threaded view
|

Re: "Read-through" implementation for sql query

Hello Andrey,

SQL queries work only with data that is already loaded into Ignite cache and does not trigger any cache store loads. If the cache is empty, the query will return empty result set. 

You need to pre-load data from store to Ignite cache before running an SQL query [1]

-- AG

Andrey Nestrogaev Andrey Nestrogaev
Reply | Threaded
Open this post in threaded view
|

Re: "Read-through" implementation for sql query

Hi Alexey,

Do I understand correctly that this is true for all Query.class subclasses?

Ok, if cache doesn't contain key k, then all call get(k) will trigger read=through functionality?

Thanks.
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: "Read-through" implementation for sql query

Hi Andrey,


On 1/27/2016 1:27 PM, Andrey Nestrogaev wrote:
> Hi Alexey,
>
> Do I understand correctly that this is true for all Query.class subclasses?
That is true for basic & fields SQL queries and text queries. However
that's not true for scan queries.

> Ok, if cache doesn't contain key k, then all call get(k) will trigger
> read=through functionality?
Correct.

--
Denis
> Thanks.
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Read-through-implementation-for-sql-query-tp2735p2737.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Andrey Nestrogaev Andrey Nestrogaev
Reply | Threaded
Open this post in threaded view
|

Re: "Read-through" implementation for sql query

Hi Denis,

Ok, lets see example from doc for ScanQuery:

IgniteCache<Long, Person> cache = ignite.cache("mycache");
// Find only persons earning more than 1,000.
try (QueryCursor cursor = cache.query(new ScanQuery((k, p) -> p.getSalary() > 1000)) {
  for (Person p : cursor)
    System.out.println(p.toString());
}

What happens if the cache is initially empty and I run this code twice?
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: "Read-through" implementation for sql query

Andrey,

I've looked into the code and seems that I was wrong before. ScanQueries
don't preload data from a storage as well.

--
Denis

On 1/27/2016 2:52 PM, Andrey Nestrogaev wrote:

> Hi Denis,
>
> Ok, lets see example from doc for ScanQuery:
>
> IgniteCache<Long, Person> cache = ignite.cache("mycache");
> // Find only persons earning more than 1,000.
> try (QueryCursor cursor = cache.query(new *ScanQuery*((k, p) ->
> p.getSalary() > 1000)) {
>    for (Person p : cursor)
>      System.out.println(p.toString());
> }
>
> What happens if the cache is initially empty and I run this code twice?
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Read-through-implementation-for-sql-query-tp2735p2740.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.