Kai Zhao
Kai Zhao

Reputation: 17

[Hive HBase Integration],when create hive table which supports auto inport data to hbase table ,how to set property "hbase.columns.mapping" value?

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

Upvotes: 0

Views: 260

Answers (1)

Sai Kranthi
Sai Kranthi

Reputation: 52

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");

Upvotes: 0

Related Questions