You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Rajesh Kishore <ra...@gmail.com> on 2018/01/18 16:05:00 UTC

how to create Index for binary or byte type value

Hi All,

The problem statement is in context of "In-Memory Data Grid" persistence
enabled.

I have requirement/limitation to store the value of a class's object as
byte [] , understood by the application in certain format.

IgniteCache<Integer, byte[]> cache =
          ignite.getOrCreateCache(cacheCfg);
// here key is ID and value is class's object as byte [] ,

Some of the instance variable (in the form of Map) of the object has
multiple key value pair
ex: one of the instance variable is
Map<String,List<String>> userAttributes;

and has values for one of the object instance as

a - v1           // userAttributes.put("a", "v1")
b - v2,v3,v4    // userAttributes.put("a", "v2","V3","v4")
......

Question is - if I want to define the index on these values of
userAttributes so that entry can be retrieved, the equivalent index would
hold the value of entry id as
(a = v1) - 100,101,201,....
(b = v4) - 201

How to achieve this functionality, any pointers? or Any other suggestions ?

Thanks,
Rajesh

Re: how to create Index for binary or byte type value

Posted by vkulichenko <va...@gmail.com>.
Rajesh,

Whether you work with POJOs or with BinaryObject API, data is stored in the
same binary format which allows to get field values without deserialization.
Therefore indexing on binary data is possible. Please go through the
documentation page I provided earlier, it gives more detailed description of
how it works.

-Val



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

Re: how to create Index for binary or byte type value

Posted by Rajesh Kishore <ra...@gmail.com>.
Hi Val,

Would indices be possible on binary data value , I dont think so. I think I
will stick with the POJO for now.

I have queries on indices and l am not relying on external persistence
system.

a) What are the different indices type Ignite supports apart from equality
i.e does it support the substring query like -  name=raj% or equivalent
b) How does indices are actually stored in Ignite, what is the performance
overhead when its a very large data set say 20 million each entry is of
size 5 kb

-Rajesh


On Fri, Jan 19, 2018 at 9:21 AM, vkulichenko <va...@gmail.com>
wrote:

> Rajesh,
>
> This actually sounds exactly like binary format Ignite uses to store the
> data: https://apacheignite.readme.io/docs/binary-marshaller
>
> Doing this manually (i.e. explicitly saving some byte array and creating
> indexes over this array) would not be possible, but I don't think you
> really
> need it. Just work with POJOs or BinaryObject-s on application level and
> Ignite will do the rest for you.
>
> -Val
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: how to create Index for binary or byte type value

Posted by vkulichenko <va...@gmail.com>.
Rajesh,

This actually sounds exactly like binary format Ignite uses to store the
data: https://apacheignite.readme.io/docs/binary-marshaller

Doing this manually (i.e. explicitly saving some byte array and creating
indexes over this array) would not be possible, but I don't think you really
need it. Just work with POJOs or BinaryObject-s on application level and
Ignite will do the rest for you.

-Val



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

Re: how to create Index for binary or byte type value

Posted by Rajesh Kishore <ra...@gmail.com>.
Yes, correct object is stored as byte array
As my attribute name is not fixed.
I want to have index on different attributes which is not directly visible
as the pojo instance variable

Rajesh

On 19 Jan 2018 3:56 a.m., "vkulichenko" <va...@gmail.com>
wrote:

> Hi Rajesh,
>
> It's not clear what you're trying to achieve. So are you going to store the
> attributes as a map or in serialized form as a byte array? And what exactly
> should be indexed?
>
> -Val
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: how to create Index for binary or byte type value

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

It's not clear what you're trying to achieve. So are you going to store the
attributes as a map or in serialized form as a byte array? And what exactly
should be indexed?

-Val



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