You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "张嘉昊 (Jira)" <ji...@apache.org> on 2021/01/06 08:52:00 UTC

[jira] [Updated] (PHOENIX-6215) Failed to create local index if I set column type is tinyint with default value

     [ https://issues.apache.org/jira/browse/PHOENIX-6215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

张嘉昊 updated PHOENIX-6215:
-------------------------
    Description: Is this error caused by the way phoenix splits fields for different types? If not , can you briefly describe the reason, thanks  (was: this is my sql:
{code:java}
//代码占位符
CREATE TABLE TEST4PHOENIX.MYTEST (
tag_id varchar(200) not null,
user_id varchar(200) not null ,
tag_name varchar(200) null,
is_delete tinyint default 0,
CONSTRAINT pk PRIMARY KEY (tag_id, user_id) ) SALT_BUCKETS = 10 ;
 
upsert into TEST4PHOENIX.MYTEST values('LB_001', '10077110', 'test', 0);
upsert into TEST4PHOENIX.MYTEST values('LB_002', '10077110', 'test', 1);

create local index MYTEST_INDEX on TEST4PHOENIX.MYTEST("TAG_NAME", "IS_DELETE");{code}
 I set column `is_delete` default 0.

After I create a local index, I don't know if this is a bug, I find this below.

 
select * from TEST4PHOENIX.MYTEST;
||TAG_ID||USER_ID||TAG_NAME||IS_DELETE||
|LB_001|10077110| test|0|
|LB_002|10077110| test|1|
 
select * from TEST4PHOENIX.MYTEST_INDEX;
||0:TAG_NAME||0:IS_DELETE||:TAG_ID||:USER_ID||
|test|0| |LB_00210077110|
|test|0| |LB_00210077110|
 
First, `is_delete` has 2 different values, but `MYTEST_INDEX` only shows 0, which is default value;
Second, we can find that in `MYTEST_INDEX` column ''TAG_ID" and "USER_ID" values have been changed. If query sql uses index, then we may return wrong data. *While column value in `MYTEST` is right*
Actually after I tried many times, I found that if I create a local index , including a column which may be `tinyint` or `integer` and has been set a dafault value, then the data in the index table will be wrong.

 

Is this a bug or I make a mistake?

 )
    Environment:     (was: phoenix-5.0.0-cdh6.2.0)

> Failed to create local index if I set column type is tinyint with default value 
> --------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6215
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6215
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 5.0.0
>            Reporter: 张嘉昊
>            Assignee: Chao Wang
>            Priority: Major
>         Attachments: image-2020-11-05-17-32-00-661.png
>
>
> Is this error caused by the way phoenix splits fields for different types? If not , can you briefly describe the reason, thanks



--
This message was sent by Atlassian Jira
(v8.3.4#803005)