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.(Rows.java:157)
at sqlline.BufferedRows.(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>
phoenix映射存在的hbase表部分数字类型和日期类型需要使用unsigned类型。此处报错是数据反序列化二进制时出错。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。