You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Mikael <mi...@telia.com> on 2018/01/29 11:35:10 UTC
Index question.
Question 1:
I am using a class that have readObject/writeObject methods so I get
this warning:
2018-01-24T16:15:49,248 [exchange-worker-#42] WARN : Some classes in
query configuration cannot be written in binary format because they
either implement Externalizable interface or have writeObject/readObject
methods. Instances of these classes will be deserialized in order to
build indexes. Please ensure that all nodes have these classes in
classpath. To enable binary serialization either implement Binarylizable
interface or set explicit serializer using
BinaryTypeConfiguration.setSerializer() method: [class
org.test.common.RtuProperties]
This class is used for the value in the cache, I set it with the
setIndexedTypes( keyclass, valueclass) because I use it in SQL queries,
but I have no @QuerySqlField annotations in that class and all SQL
queries are done using the key only and not the value, will this cause
any performance problems on indexing ? even if I have not specified any
index on the value class will Ignite have to deserialize the objects
when it builds the index data anyway ?
Question 2:
If so, is it ok to add the Binarylizable methods and interface and still
keep the Externalizable implementation in the class?
Question 3:
If I don't want any indexed data on for example the value in a cache,
but it is a primitive like a String for example, when I call
setIndexedTypes( k, v) it will create an index on the key and value, the
javadoc say nothing about using null for the value class for example,
would this be ok ? if I have a huge number of entries I would think the
performance would suffer if it has to update an index that is never used
and it waste memory also.
Mikael
Re: Index question.
Posted by Mikael <mi...@telia.com>.
No worries, the value is a hashmap that store some configuration and I
just use index on the key to get the stuff out of there so should not be
a problem.
Mikael
Den 2018-01-30 kl. 10:19, skrev Stanislav Lukyanov:
>
> To add a detail, value will have an index created for it if it is a
> primitive (or an “SQL-friendly” type like Date).
>
> I don’t think there is an easy way to avoid that. You could use a
> wrapper for the primitive value, but it will also
>
> have some overhead and it’s hard to say whether it will be more
> efficient than having an index for the value.
>
> Stan
>
> *From: *Amir Akhmedov <ma...@gmail.com>
> *Sent: *30 января 2018 г. 1:32
> *To: *user@ignite.apache.org <ma...@ignite.apache.org>
> *Subject: *Re: Index question.
>
> Ok, then it makes sense.
> You cannot pass null into setIndexedTypes(). But if you don't put any
> @QuerySqlField annotation in value class or declare fields/indexes
> through Java API then no columns/indexes will be created in SQL storage.
>
> On Mon, Jan 29, 2018 at 3:59 PM, Mikael <mikael-aronsson@telia.com
> <ma...@telia.com>> wrote:
>
> Thanks, the reason I need SQL is that my key is not a primitive,
> it's a class made of 2 int and one String and I need to query on
> parts of the key and not the entire key, like select all keys
> where one of the integers is equal to 55 for example.
>
> Mikael
>
> Den 2018-01-29 kl. 19:05, skrev Amir Akhmedov:
>
> Hi Mikael,
>
> 1. This is just a warning informing you that Ignite's object
> serialization will differ from yours Externalizable
> implementation. By default Ignite will serialize all fields in
> object and if you want to customize then you need implement
> Binarylizable interface or set custom serializer as stated in
> warning message.
>
> Even if you did not specify any @QuerySqlField in your object
> Ignite stores the whole serialized object in SQL table under
> _val field for internal usage.
>
> The open question is why do you need SQL if you are using only
> key based search? You can make exactly the same using Java
> Cache API.
>
> 2. You can leave Externalizable implementation in the class,
> it won't hurt.
>
> 3. Please check bullet #1, if you don't want indexes then you
> don't need create them.
>
> Thanks,
>
> Amir
>
>
>
>
> --
>
> Sincerely Yours Amir Akhmedov
>
RE: Index question.
Posted by Stanislav Lukyanov <st...@gmail.com>.
To add a detail, value will have an index created for it if it is a primitive (or an “SQL-friendly” type like Date).
I don’t think there is an easy way to avoid that. You could use a wrapper for the primitive value, but it will also
have some overhead and it’s hard to say whether it will be more efficient than having an index for the value.
Stan
From: Amir Akhmedov
Sent: 30 января 2018 г. 1:32
To: user@ignite.apache.org
Subject: Re: Index question.
Ok, then it makes sense.
You cannot pass null into setIndexedTypes(). But if you don't put any @QuerySqlField annotation in value class or declare fields/indexes through Java API then no columns/indexes will be created in SQL storage.
On Mon, Jan 29, 2018 at 3:59 PM, Mikael <mi...@telia.com> wrote:
Thanks, the reason I need SQL is that my key is not a primitive, it's a class made of 2 int and one String and I need to query on parts of the key and not the entire key, like select all keys where one of the integers is equal to 55 for example.
Mikael
Den 2018-01-29 kl. 19:05, skrev Amir Akhmedov:
Hi Mikael,
1. This is just a warning informing you that Ignite's object serialization will differ from yours Externalizable implementation. By default Ignite will serialize all fields in object and if you want to customize then you need implement Binarylizable interface or set custom serializer as stated in warning message.
Even if you did not specify any @QuerySqlField in your object Ignite stores the whole serialized object in SQL table under _val field for internal usage.
The open question is why do you need SQL if you are using only key based search? You can make exactly the same using Java Cache API.
2. You can leave Externalizable implementation in the class, it won't hurt.
3. Please check bullet #1, if you don't want indexes then you don't need create them.
Thanks,
Amir
--
Sincerely Yours Amir Akhmedov
Re: Index question.
Posted by Amir Akhmedov <am...@gmail.com>.
Ok, then it makes sense.
You cannot pass null into setIndexedTypes(). But if you don't put any
@QuerySqlField annotation in value class or declare fields/indexes through
Java API then no columns/indexes will be created in SQL storage.
On Mon, Jan 29, 2018 at 3:59 PM, Mikael <mi...@telia.com> wrote:
> Thanks, the reason I need SQL is that my key is not a primitive, it's a
> class made of 2 int and one String and I need to query on parts of the key
> and not the entire key, like select all keys where one of the integers is
> equal to 55 for example.
>
> Mikael
>
> Den 2018-01-29 kl. 19:05, skrev Amir Akhmedov:
>
> Hi Mikael,
>
> 1. This is just a warning informing you that Ignite's object serialization
> will differ from yours Externalizable implementation. By default Ignite
> will serialize all fields in object and if you want to customize then you
> need implement Binarylizable interface or set custom serializer as stated
> in warning message.
> Even if you did not specify any @QuerySqlField in your object Ignite
> stores the whole serialized object in SQL table under _val field for
> internal usage.
> The open question is why do you need SQL if you are using only key based
> search? You can make exactly the same using Java Cache API.
>
> 2. You can leave Externalizable implementation in the class, it won't hurt.
>
> 3. Please check bullet #1, if you don't want indexes then you don't need
> create them.
>
> Thanks,
> Amir
>
>
>
--
Sincerely Yours Amir Akhmedov
Re: Index question.
Posted by Mikael <mi...@telia.com>.
Thanks, the reason I need SQL is that my key is not a primitive, it's a
class made of 2 int and one String and I need to query on parts of the
key and not the entire key, like select all keys where one of the
integers is equal to 55 for example.
Mikael
Den 2018-01-29 kl. 19:05, skrev Amir Akhmedov:
> Hi Mikael,
>
> 1. This is just a warning informing you that Ignite's object
> serialization will differ from yours Externalizable implementation. By
> default Ignite will serialize all fields in object and if you want to
> customize then you need implement Binarylizable interface or set
> custom serializer as stated in warning message.
> Even if you did not specify any @QuerySqlField in your object Ignite
> stores the whole serialized object in SQL table under _val field for
> internal usage.
> The open question is why do you need SQL if you are using only key
> based search? You can make exactly the same using Java Cache API.
>
> 2. You can leave Externalizable implementation in the class, it won't
> hurt.
>
> 3. Please check bullet #1, if you don't want indexes then you don't
> need create them.
>
> Thanks,
> Amir
Re: Index question.
Posted by Amir Akhmedov <am...@gmail.com>.
Hi Mikael,
1. This is just a warning informing you that Ignite's object serialization
will differ from yours Externalizable implementation. By default Ignite
will serialize all fields in object and if you want to customize then you
need implement Binarylizable interface or set custom serializer as stated
in warning message.
Even if you did not specify any @QuerySqlField in your object Ignite stores
the whole serialized object in SQL table under _val field for internal
usage.
The open question is why do you need SQL if you are using only key based
search? You can make exactly the same using Java Cache API.
2. You can leave Externalizable implementation in the class, it won't hurt.
3. Please check bullet #1, if you don't want indexes then you don't need
create them.
Thanks,
Amir