给hbase的表创建phoenix映射之后再phoenix里面查询的时候包这个错

Hbase创建行程表
create 'MAPBAR_CARTRAVEL',{'NAME'=>'carTrack', 'COMPRESSION'=>'SNAPPY'},{'NAME'=>'carTravel', 'COMPRESSION'=>'SNAPPY'}, {'NAME'=>'originalData', 'COMPRESSION'=>'SNAPPY'},{SPLITS_FILE=>'region_split_info.txt'}

表结构
{NAME => 'carTrack', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
{NAME => 'carTravel', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
{NAME => 'originalData', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}

phoenix创建Hbase行程映射表
create table "MAPBAR_CARTRAVEL"("ROW" varchar primary key, "carTrack"."lonlat" varchar,"carTrack"."roadTime" varchar,"carTrack"."speed" varchar,"carTrack"."hdop" varchar,"carTrack"."dire" varchar,"carTrack"."altitude" varchar,"carTravel"."name" varchar,"carTravel"."distance" varchar,"carTravel"."tratime" varchar,"carTravel"."avgSpeed" varchar,"carTravel"."maxSpeed" varchar,"carTravel"."overSpeed" varchar,"carTravel"."brake" INTEGER,"carTravel"."swerve" INTEGER,"carTravel"."speedUp" INTEGER,"originalData"."tid" varchar);

错误:
0: jdbc:phoenix:192.168.145.80:2181> select * from MAPBAR_CARTRAVEL;
Error: ERROR 201 (22000): Illegal data. Expected length of at least 4 bytes, but had 1 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 4 bytes, but had 1
at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:422)
at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
at org.apache.phoenix.schema.KeyValueSchema.next(KeyValueSchema.java:211)
at org.apache.phoenix.expression.ProjectedColumnExpression.evaluate(ProjectedColumnExpression.java:115)
at org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:69)
at org.apache.phoenix.jdbc.PhoenixResultSet.getObject(PhoenixResultSet.java:524)
at sqlline.Rows$Row.<init>(Rows.java:157)
at sqlline.BufferedRows.<init>(BufferedRows.java:38)
at sqlline.SqlLine.print(SqlLine.java:1650)
at sqlline.Commands.execute(Commands.java:833)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:808)
at sqlline.SqlLine.begin(SqlLine.java:681)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
0: jdbc:phoenix:192.168.145.80:2181>
已邀请:

jinqian

赞同来自: ProgramGeek beyond

phoenix映射存在的hbase表部分数字类型和日期类型需要使用unsigned类型。此处报错是数据反序列化二进制时出错。

Leo

赞同来自: Marshal丶张

数据是先进入hbase再用phoenix映射的吗?如果是的话那就是数据类型的问题,把phoenix的数据类型全部改为string就可以了

要回复问题请先登录注册


中国HBase技术社区微信公众号:
hbasegroup

欢迎加入HBase生态+Spark社区钉钉大群