hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nabajyoti Dash <nabajyoti.dash1...@gmail.com>
Subject how to read Read base byte in hive
Date Sun, 05 Feb 2017 15:58:41 GMT
Hi,
I have a Hbase table like below:

hbase(main):004:0> scan 'kafka_conn', {VERSIONS => 10}
ROW                                                   COLUMN+CELL                        
 test_0909                                            column=offset:value, timestamp=1483558076087,
value=\x00\x00\x00\x00\x00\x00\x00\x0F
 test_0910                                            column=offset:value, timestamp=1483498353863,
value=\x00\x00\x00\x00\x00\x00\x00\x0A
 test_0911                                            column=offset:value, timestamp=1483504038021,
value=111                             
 test_0919                                            column=offset:value, timestamp=1483505296398,
value=5             
 test_0920                                            column=offset:value, timestamp=1483505356278,
value=5
I have written this query to bring this table to hive:

CREATE EXTERNAL TABLE `hbase_table_4`(
  `key` string COMMENT 'from deserializer', 
  `value` bigint COMMENT 'from deserializer')
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.hbase.HBaseSerDe' 
STORED BY 
  'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
WITH SERDEPROPERTIES ( 
  'hbase.columns.mapping'='offset:value', 
  'serialization.format'='1')
TBLPROPERTIES (
  'hbase.table.name'='kafka_conn', 
  'transient_lastDdlTime'='1483506197')

The result is:

hive> select * from hbase_table_4;
OK
test_0909	NULL
test_0910	NULL
test_0911	111
test_0919	5
test_0920	5


Can anyone please tell me how to get the int/long values in hive (stored as bytes in base).
I tried adding #b and using string datatypes.But they give hexaDecimal values.
Is there any other way to retrieve these?

To understand the problem better you can refer http://stackoverflow.com/questions/12909118/number-type-value-in-hbase-not-recognized-by-hive
<http://stackoverflow.com/questions/12909118/number-type-value-in-hbase-not-recognized-by-hive>

Thanks in advance.

Regards,
Nabajyoti
Mime
View raw message