1
votes

I have created Hbase table EMP which has column family f1 and and ID as rowkey and NAME as another column field.

When I create Phoenix View on top of this Hbase table as

CREATE view EMP(ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(40)); and run select state, Phoenix view shows Negative values for ID column. Actual value in Hbase is something like 101,102,103... but when I run "select id from EMP" in Phoenix, i get values as -101 -102 -103

I tried o change data type for ID from Integer to Unassigned_Int which completely change the actual value of ID. it comes as 32423 23429 12432

Can you please advise on how to define Primary Key in Phoenix as numerical value, not varchar as i will perform Sum(id) on it and Sum() wont work on Varchar.

I also tried to use Cast function in Phoenix, but that function is not able cast Varchar to Integer.

Thanks, Abhishek

1

1 Answers

0
votes

How did you load data into an existing HBase table? If non-Text (int, float etc.) values are serialized using hexa-decimal byte[] format with \x escape then you might want to try creating Phoenix table/view with UNSIGNED_INT or UNSIGNED_FLOAT fields for these values.