I am having problems writing data from HBase and reading it with Phoenix. These are the steps to reproduce the problem:
Create a table using Phoenix.
CREATE TABLE test (
id varchar not null,
t1.a unsigned_int,
t1.b varchar
CONSTRAINT pk PRIMARY KEY (id))
COLUMN_ENCODED_BYTES = 0;
If I add information to the table using Phoenix using Upsert
upsert into test (id, t1.a, t1.b) values ('a1',1,'foo_a');
And I try query the table, I get this:
select * from test;
+-----+----+--------+
| ID | A | B |
+-----+----+--------+
| a1 | 1 | foo_a |
+-----+----+--------+
At this point everything work as expected, but now I am going to add a new entry using HBase directly.
put 'TEST', 'id_1','T1:A', 2
put 'TEST', 'id_1','T1:B','some text'
After that I can't query the table anymore, getting this:
select * from test;
Error: ERROR 201 (22000): Illegal data. Expected length of at least 4 bytes, but had 1 (state=22000,code=201)
I know that the problem is related to how HBase is storing the unsigned_int, and if I remove this column from the table, the queries will work again. How can this problem be solved?