Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Apache Phoenix illegal data exception

Highlighted

Apache Phoenix illegal data exception

New Contributor

I am having problems writing data from HBase and reading it with Phoenix.

hese 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:

91724-screenshot-1.png

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.

My questions are:

  • What I am doing wrong?
  • How can this problem be solved?

Thanks in advance.