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

classic Classic list List threaded Threaded
6 messages Options
okni-67 okni-67
Reply | Threaded
Open this post in threaded view
|

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.


a.dolmatov a.dolmatov
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]> 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-3.png (7K) Download Attachment
PastedGraphic-4.png (81K) Download Attachment
PastedGraphic-2.png (230K) Download Attachment
PastedGraphic-1.png (11K) Download Attachment
okni-67 okni-67
Reply | Threaded
Open this post in threaded view
|

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


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 <[hidden email]> 写道:

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 <[hidden email]> 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>

ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]>:

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 <[hidden email]> 写道:

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 <[hidden email]> 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>

okni-67 okni-67
Reply | Threaded
Open this post in threaded view
|

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

@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 <[hidden email]>写道:

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 <[hidden email]>:

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 <[hidden email]> 写道:

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 <[hidden email]> 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>


ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

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

Hello!

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

Regards,
--
Ilya Kasnacheev


вт, 9 июл. 2019 г. в 14:23, okni-67 <[hidden email]>:
@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 <[hidden email]>写道:

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 <[hidden email]>:

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 <[hidden email]> 写道:

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 <[hidden email]> 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>