You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by okni-67 <ya...@163.com> on 2019/07/09 01:56:00 UTC

add data to table, sql add ,cache add has different result ,I use ignite 2.6

>   i created  a table below
> 
> CREATE TABLE IF NOT EXISTS person (
>   id int,
>   city_id int,
>   name varchar,
>   age int, 
>   company varchar,
>   PRIMARY KEY (id, city_id)
> ) WITH "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id, key_type=org.apache.ignite.cache.affinity.AffinityKey, value_type=com.okni.okkong.data.common.entity.Person”;
> 
> And I use sql below 
> 
> INSERT INTO person values(2,5,'test1',19,'okni’)
> 
> I can find data like below
> 
> 
> And. I use ignite cache put binary object like  below
> 
> 
> 
> This problem is in DBeaver my new data id and city_id is null.
> 
> 
> 
>   I use cache can get the cache insert id and city id value, but the sql insert operate data the id is null, like below
> 
> 
> I want to know why , thanks.
> 


Re: add data to table, sql add ,cache add has different result ,I use ignite 2.6

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

As already mentioned, those must be key fields, not value fields.

Regards,
-- 
Ilya Kasnacheev


вт, 9 июл. 2019 г. в 14:23, okni-67 <ya...@163.com>:

> @ilya.kasnacheev
> The  id=6 and id=5 use cache insert , you can see the id and cityId also
> have value  blow,but in the dbeaver the value can’t see
>
>
> 在 2019年7月9日,下午6:17,Ilya Kasnacheev <il...@gmail.com>写道:
>
>
> Hello!
>
> I think you should not be using AffinityKey type here but rather your own
> custom type (similar with value) and name its fields "id" and "city_id".
>
> I don't think you can change names of fields when using AffinityKey.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> вт, 9 июл. 2019 г. в 07:09, okni-67 <ya...@163.com>:
>
>>
>> City_id is defined in the key, key never show in the value?  How can I
>> use sql insert ,insert the key like cache , and how can I use cache insert,
>> insert the value like sql ,I want insert use cache or use sql keep the same
>> . Can you give me a solution?
>>
>> 在 2019年7月9日,上午11:46,Andrey Dolmatov <it...@gmail.com> 写道:
>>
>> Cityid should be part of key builder, not value builder. That's because
>> cityid defined in the key
>>
>> On Tue, Jul 9, 2019, 4:56 AM okni-67 <ya...@163.com> wrote:
>>
>>>
>>>   i created  a table below
>>>
>>> *CREATE* *TABLE* *IF* *NOT* *EXISTS* person (
>>>   id *int*,
>>>   city_id *int*,
>>>   name *varchar*,
>>>   age *int*,
>>>   company *varchar*,
>>>   *PRIMARY* *KEY* (id, city_id)
>>> ) *WITH* "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id,
>>> key_type=org.apache.ignite.cache.affinity.AffinityKey,
>>> value_type=com.okni.okkong.data.common.entity.Person”;
>>>
>>> And I use sql below
>>>
>>> *INSERT* *INTO* person *values*(2,5,'test1',19,'okni’)
>>>
>>> I can find data like below
>>>
>>> And. I use ignite cache put binary object like  below
>>>
>>>
>>> This problem is in DBeaver my new data id and city_id is null.
>>>
>>>
>>>   I use cache can get the cache insert id and city id value, but the sql
>>> insert operate data the id is null, like below
>>>
>>> I want to know why , thanks.
>>>
>>>
>>>
>>> <PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png>
>> <PastedGraphic-1.png>
>>
>>
>>
>

Re: add data to table, sql add ,cache add has different result ,I use ignite 2.6

Posted by okni-67 <ya...@163.com>.
@ilya.kasnacheev
The  id=6 and id=5 use cache insert , you can see the id and cityId also have value  blow,but in the dbeaver the value can’t see
 


> 在 2019年7月9日,下午6:17,Ilya Kasnacheev <il...@gmail.com>写道:
> 
> Hello!
> 
> I think you should not be using AffinityKey type here but rather your own custom type (similar with value) and name its fields "id" and "city_id".
> 
> I don't think you can change names of fields when using AffinityKey.
> 
> Regards,
> -- 
> Ilya Kasnacheev
> 
> 
> вт, 9 июл. 2019 г. в 07:09, okni-67 <yanlei3032@163.com <ma...@163.com>>:
> 
> City_id is defined in the key, key never show in the value?  How can I use sql insert ,insert the key like cache , and how can I use cache insert, insert the value like sql ,I want insert use cache or use sql keep the same . Can you give me a solution?
> 
>> 在 2019年7月9日,上午11:46,Andrey Dolmatov <itdolmatov@gmail.com <ma...@gmail.com>> 写道:
>> 
>> Cityid should be part of key builder, not value builder. That's because cityid defined in the key
>> 
>> On Tue, Jul 9, 2019, 4:56 AM okni-67 <yanlei3032@163.com <ma...@163.com>> wrote:
>> 
>>>   i created  a table below
>>> 
>>> CREATE TABLE IF NOT EXISTS person (
>>>   id int,
>>>   city_id int,
>>>   name varchar,
>>>   age int, 
>>>   company varchar,
>>>   PRIMARY KEY (id, city_id)
>>> ) WITH "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id, key_type=org.apache.ignite.cache.affinity.AffinityKey, value_type=com.okni.okkong.data.common.entity.Person”;
>>> 
>>> And I use sql below 
>>> 
>>> INSERT INTO person values(2,5,'test1',19,'okni’)
>>> 
>>> I can find data like below
>>> 
>>> 
>>> And. I use ignite cache put binary object like  below
>>> 
>>> 
>>> 
>>> This problem is in DBeaver my new data id and city_id is null.
>>> 
>>> 
>>> 
>>>   I use cache can get the cache insert id and city id value, but the sql insert operate data the id is null, like below
>>> 
>>> 
>>> I want to know why , thanks.
>>> 
>> 
>> <PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png>
> 


Re: add data to table, sql add ,cache add has different result ,I use ignite 2.6

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

I think you should not be using AffinityKey type here but rather your own
custom type (similar with value) and name its fields "id" and "city_id".

I don't think you can change names of fields when using AffinityKey.

Regards,
-- 
Ilya Kasnacheev


вт, 9 июл. 2019 г. в 07:09, okni-67 <ya...@163.com>:

>
> City_id is defined in the key, key never show in the value?  How can I use
> sql insert ,insert the key like cache , and how can I use cache insert,
> insert the value like sql ,I want insert use cache or use sql keep the same
> . Can you give me a solution?
>
> 在 2019年7月9日,上午11:46,Andrey Dolmatov <it...@gmail.com> 写道:
>
> Cityid should be part of key builder, not value builder. That's because
> cityid defined in the key
>
> On Tue, Jul 9, 2019, 4:56 AM okni-67 <ya...@163.com> wrote:
>
>>
>>   i created  a table below
>>
>> *CREATE* *TABLE* *IF* *NOT* *EXISTS* person (
>>   id *int*,
>>   city_id *int*,
>>   name *varchar*,
>>   age *int*,
>>   company *varchar*,
>>   *PRIMARY* *KEY* (id, city_id)
>> ) *WITH* "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id,
>> key_type=org.apache.ignite.cache.affinity.AffinityKey,
>> value_type=com.okni.okkong.data.common.entity.Person”;
>>
>> And I use sql below
>>
>> *INSERT* *INTO* person *values*(2,5,'test1',19,'okni’)
>>
>> I can find data like below
>>
>> And. I use ignite cache put binary object like  below
>>
>>
>> This problem is in DBeaver my new data id and city_id is null.
>>
>>
>>   I use cache can get the cache insert id and city id value, but the sql
>> insert operate data the id is null, like below
>>
>> I want to know why , thanks.
>>
>>
>>
>> <PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png>
> <PastedGraphic-1.png>
>
>
>

Re: add data to table, sql add ,cache add has different result ,I use ignite 2.6

Posted by okni-67 <ya...@163.com>.
City_id is defined in the key, key never show in the value?  How can I use sql insert ,insert the key like cache , and how can I use cache insert, insert the value like sql ,I want insert use cache or use sql keep the same . Can you give me a solution?

> 在 2019年7月9日,上午11:46,Andrey Dolmatov <it...@gmail.com> 写道:
> 
> Cityid should be part of key builder, not value builder. That's because cityid defined in the key
> 
> On Tue, Jul 9, 2019, 4:56 AM okni-67 <yanlei3032@163.com <ma...@163.com>> wrote:
> 
>>   i created  a table below
>> 
>> CREATE TABLE IF NOT EXISTS person (
>>   id int,
>>   city_id int,
>>   name varchar,
>>   age int, 
>>   company varchar,
>>   PRIMARY KEY (id, city_id)
>> ) WITH "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id, key_type=org.apache.ignite.cache.affinity.AffinityKey, value_type=com.okni.okkong.data.common.entity.Person”;
>> 
>> And I use sql below 
>> 
>> INSERT INTO person values(2,5,'test1',19,'okni’)
>> 
>> I can find data like below
>> 
>> 
>> And. I use ignite cache put binary object like  below
>> 
>> 
>> 
>> This problem is in DBeaver my new data id and city_id is null.
>> 
>> 
>> 
>>   I use cache can get the cache insert id and city id value, but the sql insert operate data the id is null, like below
>> 
>> 
>> I want to know why , thanks.
>> 
> 
> <PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png>


Re: add data to table, sql add ,cache add has different result ,I use ignite 2.6

Posted by Andrey Dolmatov <it...@gmail.com>.
Cityid should be part of key builder, not value builder. That's because
cityid defined in the key

On Tue, Jul 9, 2019, 4:56 AM okni-67 <ya...@163.com> wrote:

>
>   i created  a table below
>
> *CREATE* *TABLE* *IF* *NOT* *EXISTS* person (
>   id *int*,
>   city_id *int*,
>   name *varchar*,
>   age *int*,
>   company *varchar*,
>   *PRIMARY* *KEY* (id, city_id)
> ) *WITH* "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id,
> key_type=org.apache.ignite.cache.affinity.AffinityKey,
> value_type=com.okni.okkong.data.common.entity.Person”;
>
> And I use sql below
>
> *INSERT* *INTO* person *values*(2,5,'test1',19,'okni’)
>
> I can find data like below
>
> And. I use ignite cache put binary object like  below
>
>
> This problem is in DBeaver my new data id and city_id is null.
>
>
>   I use cache can get the cache insert id and city id value, but the sql
> insert operate data the id is null, like below
>
> I want to know why , thanks.
>
>
>
>