[
https://issues.apache.org/jira/browse/PHOENIX-6215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258875#comment-17258875
]
Istvan Toth commented on PHOENIX-6215:
--------------------------------------
Specifying a default value for a field shouldn't affect indexing.
However, you are using a Phoenix release by Cloudera, that the Apache Phoenix
community cannot access, and cannot debug or fix.
Please try to reproduce the error with the master branch (you can start a
simple Phoenix environment with the bin/phoenix_sandbox.py script without
setting up a real cluster).
You can also contact Cloudera's support, who should be able to help you.
> 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
> Environment: phoenix-5.0.0-cdh6.2.0
> Reporter: 张嘉昊
> Assignee: Chao Wang
> Priority: Major
> Attachments: image-2020-11-05-17-32-00-661.png
>
>
> 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?
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)