1、关于数据类型负数或hbase解析报
java.sgl.SQLException: ERROR 201 (22000): ILlegal data. Expected length of at least 8 bytes
2、是数字类型的话在put的时候记得用Bytes.toBytes(数字)转一下
put 'bigdata:student','1001','msg:age',Bytes.toBytes(28)
使用toLong查看数据
scan 'bigdata:student',{COLUMNS => 'msg:age:toLong'}
3、表映射的创建对应的字段
可以使用unsigned_int,unsigned_long如果无需考虑负数,那在 Phoenix 中建表时采用无符号类型是最合适的选择。
官方文档
表映射创建教程
--表映射
create table "bigdata"."student"(
id varchar primary key,
"info"."name" varchar ,
"msg"."age" unsigned_long
) column_encoded_bytes=0;
--视图映射
create view "bigdata"."student"(
id varchar primary key,
"info"."name" varchar ,
"msg"."age" unsigned_long
)
成功