0
votes

CREATE TABLE hbase_table_1 (key int, value1 string, value2 int, value3 int) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ( "hbase.columns.mapping" = ":key,a:b,a:c,d:e" );

INSERT OVERWRITE TABLE hbase_table_1 SELECT foo, bar, foo+1, foo+2 FROM pokes WHERE foo=98 OR foo=100;

I am new to hbase and hive ?when i want to auto import data to hbase from hive, found this page on official website [https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration]

This is the apache example!and i cant understand this property's value ? somebody could explain this to me ???

And i want to know how to set this property's value!

Thanks

1
Properties values are nothing but mapping hbase table columns to hive columns..In Hbase its all column oriented.. where as in hive its row oriented.. you need to specify in hive which column of hbase should map with in hive. - marjun
i have searched the answer in stackoverflow..but thanks anyway - Kai Zhao

1 Answers

0
votes

Create Hive Integrated Hbase Table:

hive -e "INSERT OVERWRITE TABLE hivedbnm.hivehbasetblnm 
SELECT * FROM hivedbnm.temphivetable;"

CREATE TABLE ${hiveconf:hivedbnm}.hivehbasetblnm (
key string, C1 decimal(10,4))
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:C1")
TBLPROPERTIES ("hbase.table.name" = "hbasetblnm", "hbase.mapred.output.outputtable" = "hbasetblnm");