You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by fatality <fa...@gmail.com> on 2017/05/20 10:27:58 UTC

Adding new fields to QueryEntity

Hi 

I am wondering if it is possible to add new fields for sql queries to
BinaryObject caches. 

For example imagine I already have BinaryObjects that has fields X,Y,Z in my
cache. And later I wanted to add one more field which is 'W'. Is it going to
be possible to just adding this field to new BinaryObjects to do sql queries
on 'W' as in below 'Step1' or do I have to do more?

Imagining something like below Step1 should be enough to start querying on
the existing cache with fields X,Y,Z so that I can make a query like "select
X,W from BinaryTest where W=32"

cfg.setQueryEntities(new ArrayList<QueryEntity>() {{
   QueryEntity e = new QueryEntity();
   e.setKeyType("java.lang.Integer");
   e.setValueType("BinaryTest");
   e.setFields(new LinkedHashMap<String, String>(){{
   put("X", "java.lang.String");
   put("Y", "java.lang.String");
   put("Z", "java.lang.String");
   put("W", "java.lang.String"); //Step1
 }});




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Adding-new-fields-to-QueryEntity-tp13043.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Adding new fields to QueryEntity

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

New fields can be added dynamically - just add field A to your business
object, update application logic and restart the app. No manual update of
QueryEntity required. Make A field an index field with DDL in runtime if
needed. A restart of the data/server nodes is avoided.

I considered the approach above. Sounds feasible, right?

Denis

On Monday, May 22, 2017, fatality <fa...@gmail.com> wrote:

> I guess that means both create index and QueryEntity change needed?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Adding-new-fields-to-QueryEntity-tp13043p13052.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Adding new fields to QueryEntity

Posted by fatality <fa...@gmail.com>.
I guess that means both create index and QueryEntity change needed?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Adding-new-fields-to-QueryEntity-tp13043p13052.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Adding new fields to QueryEntity

Posted by Vladimir Ozerov <vo...@gridgain.com>.
Denis,

I think the question not about new indexes, but about new fields. The
answer is - you must change QueryEntity manually still.

сб, 20 мая 2017 г. в 16:25, Denis Magda <dm...@gridgain.com>:

> Hi,
>
> You need to use CREATE index command in runtime to achieve that:
> https://apacheignite.readme.io/docs/distributed-ddl
>
> Denis
>
>
> On Saturday, May 20, 2017, fatality <fa...@gmail.com> wrote:
>
>> Hi
>>
>> I am wondering if it is possible to add new fields for sql queries to
>> BinaryObject caches.
>>
>> For example imagine I already have BinaryObjects that has fields X,Y,Z in
>> my
>> cache. And later I wanted to add one more field which is 'W'. Is it going
>> to
>> be possible to just adding this field to new BinaryObjects to do sql
>> queries
>> on 'W' as in below 'Step1' or do I have to do more?
>>
>> Imagining something like below Step1 should be enough to start querying on
>> the existing cache with fields X,Y,Z so that I can make a query like
>> "select
>> X,W from BinaryTest where W=32"
>>
>> cfg.setQueryEntities(new ArrayList<QueryEntity>() {{
>>    QueryEntity e = new QueryEntity();
>>    e.setKeyType("java.lang.Integer");
>>    e.setValueType("BinaryTest");
>>    e.setFields(new LinkedHashMap<String, String>(){{
>>    put("X", "java.lang.String");
>>    put("Y", "java.lang.String");
>>    put("Z", "java.lang.String");
>>    put("W", "java.lang.String"); //Step1
>>  }});
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-ignite-users.70518.x6.nabble.com/Adding-new-fields-to-QueryEntity-tp13043.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>

Re: Adding new fields to QueryEntity

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

You need to use CREATE index command in runtime to achieve that:
https://apacheignite.readme.io/docs/distributed-ddl

Denis

On Saturday, May 20, 2017, fatality <fa...@gmail.com> wrote:

> Hi
>
> I am wondering if it is possible to add new fields for sql queries to
> BinaryObject caches.
>
> For example imagine I already have BinaryObjects that has fields X,Y,Z in
> my
> cache. And later I wanted to add one more field which is 'W'. Is it going
> to
> be possible to just adding this field to new BinaryObjects to do sql
> queries
> on 'W' as in below 'Step1' or do I have to do more?
>
> Imagining something like below Step1 should be enough to start querying on
> the existing cache with fields X,Y,Z so that I can make a query like
> "select
> X,W from BinaryTest where W=32"
>
> cfg.setQueryEntities(new ArrayList<QueryEntity>() {{
>    QueryEntity e = new QueryEntity();
>    e.setKeyType("java.lang.Integer");
>    e.setValueType("BinaryTest");
>    e.setFields(new LinkedHashMap<String, String>(){{
>    put("X", "java.lang.String");
>    put("Y", "java.lang.String");
>    put("Z", "java.lang.String");
>    put("W", "java.lang.String"); //Step1
>  }});
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Adding-new-fields-to-QueryEntity-tp13043.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>