The problem with BigInteger is it takes around 80 bytes. I will be having 2 BigInteger fields in my class which will take around 176 bytes per record. I will be having around 40 to 60 million such entries in my cache.
So I am thinking to squeeze some bytes using two long numbers or using two byte arrays. How can I create index on byte array field and create index on it and use it in where clause. Can you give simple example? Also if I use Int128 data type, how can I create index on it and use it in where clause? Simple example would be helpful. Thanks, Prasad On Fri 28 Jun, 2019, 10:24 PM Ilya Lantukh <[email protected] wrote: > Hi, > > Theoretically, you can create an index and use >= and <= comparisons for > any data type. In your particular case, I think, using BigInteger is the > most straightforward approach. > > Hope this helps. > > On Fri, Jun 28, 2019 at 9:39 AM Prasad Bhalerao < > [email protected]> wrote: > >> Hi, >> >> I want to store 128 bit number as a one the field in value object in my >> cache. >> >> I can do that using multiple ways. >> e.g. >> 1) I can store 128 bit number using java.math.BigInteger. >> a) But If store it using BigInteger, can I create index on this >> field? >> b) How can I use this field in where clause to filter the data? >> >> 2) I can store 128 bit number using byte array (byte[]). >> a) Can I create an index on byte array? >> b) Can I use this byte array field in where clause to filter the data. >> e.g. mostly the where clause would be bytearr >=? and bytearr >> <= >> >> 3) I can implement my own Number datatype e.g. Int128 using two long >> numbers and and I implement compareTo method which is a bit tricky. >> a) I can create index on nested objects but how I can use this Int128 >> data type field in where clause and make use of overridden compareTo method >> to filter the data? >> >> Can someone please advise? >> >> >> >> Thanks, >> Prasad >> >> >>
