jate sun
jate sun

Reputation: 53

Hive with Hbase integration null

everyone.I try use hbase integration but had a problem.the timestamp field query by hive is null. my sql is:

CREATE EXTERNAL TABLE hbase_data(nid string, dillegaldate timestamp, coffense string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES( "hbase.columns.mapping"=":key,0:DILLEGALTIMESTAMP,0:COFFENSE") TBLPROPERTIES("hbase.table.name" = "ILLEGAL_DATA");

excute success,but query through hive

select * from hbase_data limit 10;

the column dillegaldate is null,I googled for it a lot of time but still not find the problem.Can anyone tell me how to solve it?thank you very much

Upvotes: 0

Views: 650

Answers (1)

wangxiaolei
wangxiaolei

Reputation: 41

0:DILLEGALTIMESTAMP replace by 0:DILLEGALTIMESTAMP#b

CREATE EXTERNAL TABLE hbase_data(nid string, dillegaldate timestamp, coffense string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES( "hbase.columns.mapping"=":key,0:DILLEGALTIMESTAMP#b,0:COFFENSE") TBLPROPERTIES("hbase.table.name" = "ILLEGAL_DATA");

a mapping entry must be either :key, :timestamp or of the form column-family-name:[column-name][#(binary|string) (the type specification that delimited by # was added in Hive 0.9.0, earlier versions interpreted everything as strings) If no type specification is given the value from hbase.table.default.storage.type will be used Any prefixes of the valid values are valid too (i.e. #b instead of #binary) If you specify a column as binary the bytes in the corresponding HBase cells are expected to be of the form that HBase's Bytes class yields.

HBaseIntegration

Upvotes: 2

Related Questions