Month: July 2016

How to Mount HBase Table as Hive External Table

Posted on Updated on

HBase table: “h_test_table”
Hive table: “test_table”

notes:
attribute:column1″
attribute << is the COLUMN FAMILY

Example:

CREATE EXTERNAL TABLE test_table (
 raw_key STRING,
 column1 STRING,
 column2 STRING,
 value STRING,
 updated_at bigint)
 STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
 WITH SERDEPROPERTIES (
 'hbase.columns.mapping'=':key,attribute:column1,attribute:column1,attribute:value,attribute:updated_at'
 )
 TBLPROPERTIES("hbase.table.name" = "h_test_table");
Advertisements