-Mapping existing HBase table with many columns to Hive.
David Koch 2012-12-06, 18:56
How can I map an HBase table with the following layout to Hive using the
"CREATE EXTERNAL TABLE" command from shell (or another programmatic way):
The HBase table's layout is as follows:
Rowkey=16 bytes, a UUID that had the "-" removed, and the 32hex chars
converted into two 8byte longs.
Columns (qualifiers): timestamps, i.e the bytes of a long which were
converted using Hadoop's Bytes.toBytes(long). There can be many of those in
a single row.
Values: The bytes of a Java string.
I am unsure of which datatypes to use. I am pretty sure there is no way I
can sensible map the row key to anything other than "binary" but maybe the
columns - which are longs and the values which are strings can be mapped to
their according Hive datatypes.
I include an extract of what a row looks like in HBase shell below:
hbase(main):009:0> scan "hits"
column=t:\x00\x00\x01;2\xE6Q\x06, timestamp=1267737987733, value=blahaha
column=t:\x00\x00\x01;2\xE6\xFB@, timestamp=1354012104967, value=testtest