You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Andrey Nestrogaev <a....@flexsoft.com> on 2016/01/22 09:10:48 UTC

Sql Query using Map as value for cache

Hi!

Testing Ignite 1.5.0.

Can we use Query, QueryIndexes over caches where values is a Map.class
subclasses?
Or its possible only for POJO as a value?

Thanks!



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Sql-Query-using-Map-as-value-for-cache-tp2668.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Sql Query using Map as value for cache

Posted by Andrey Nestrogaev <a....@flexsoft.com>.
Hi Val,

BinaryObject is what I was looking for. I've tested it and it suits for my
task.

Thank you very mach!



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Sql-Query-using-Map-as-value-for-cache-tp2668p2688.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Sql Query using Map as value for cache

Posted by vkulichenko <va...@gmail.com>.
Hi Andrey,

Sounds like binary objects [1] could be useful for your use case. You can
create cache objects on the fly using BinaryBuilder and they will support
field lookups directly from byte array. It's like saving a POJO, but without
having a POJO :)

Cache itself can be easily created dynamically as well [2].

Hope this helps.

[1] https://apacheignite.readme.io/docs/binary-marshaller
[2] https://apacheignite.readme.io/v1.5/docs/jcache#section-dynamic-cache

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Sql-Query-using-Map-as-value-for-cache-tp2668p2680.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Sql Query using Map as value for cache

Posted by Andrey Nestrogaev <a....@flexsoft.com>.
Hi, thanks for response!

/"Maps should be
compared using equals() method implementation and sorted (maps
instances) according to compareTo() method/"

I do not quite understand what the problem is, is POJO do not need to do the
same?

My usecase is to create new queryable caches (queryable by sql query) at
runtime.
What is your recommendation for such usecases?


Thanks!



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Sql-Query-using-Map-as-value-for-cache-tp2668p2678.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Sql Query using Map as value for cache

Posted by Denis Magda <dm...@gridgain.com>.
Hi,

I'll highly discourage you doing this.

I didn't check but probably you won't get any runtime exception if to 
mark such a value as an index but no magic will happen. Maps should be 
compared using equals() method implementation and sorted (maps 
instances) according to compareTo() method.

So my suggestion is to redesign your data model to avoid such use cases.

--
Denis

On 1/22/2016 11:10 AM, Andrey Nestrogaev wrote:
> Hi!
>
> Testing Ignite 1.5.0.
>
> Can we use Query, QueryIndexes over caches where values is a Map.class
> subclasses?
> Or its possible only for POJO as a value?
>
> Thanks!
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Sql-Query-using-Map-as-value-for-cache-tp2668.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.