hiveql - How can i map Hive table with HBase table? -


i have created hbase table following:

create 'nancy', 'cf'

and created table in hive below:

create external table nancy( id int, name string)

stored 'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties ("hbase.columns.mapping" = ":key, cf:name")

tblproperties("hbase.table.name"="nancy");

am mapping write? key in "hbase.columns.mapping" signifies?

can explain mapping?

are facing specific problem?query looks ok me.

key represents using field table key. remember every field in hive table can mapped 1 of these :

  • table key (using :key selector)
  • column family (cf:) (map fields in hive
  • column

in response comments :

hive> create external table hbase_table_2(key int, name string)      > stored 'org.apache.hadoop.hive.hbase.hbasestoragehandler'     > serdeproperties ("hbase.columns.mapping" = ":key,cf:name")     > tblproperties("hbase.table.name" = "nancy"); ok time taken: 5.106 seconds  hive> select * hbase_table_2; ok time taken: 0.077 seconds  hive> insert overwrite table hbase_table_2 select * demo id=1; total mapreduce jobs = 1 launching job 1 out of 1 number of reduce tasks set 0 since there's no reduce operator starting job = job_201308011237_0003, tracking url = http://localhost:50030/jobdetails.jsp?jobid=job_201308011237_0003 kill command = /users/miqbal1/hadoop-eco/hadoop-1.1.2/libexec/../bin/hadoop job  -kill job_201308011237_0003 hadoop job information stage-0: number of mappers: 1; number of reducers: 0 2013-08-01 16:29:21,832 stage-0 map = 0%,  reduce = 0% 2013-08-01 16:29:23,843 stage-0 map = 100%,  reduce = 0% 2013-08-01 16:29:24,849 stage-0 map = 100%,  reduce = 100% ended job = job_201308011237_0003 1 rows loaded hbase_table_2 mapreduce jobs launched:  job 0: map: 1   hdfs read: 256 hdfs write: 0 success total mapreduce cpu time spent: 0 msec ok time taken: 8.392 seconds hive>  

and hbase table :

hbase(main):017:0> scan 'nancy' row                                      column+cell                                                                                                            1                                       column=cf:name, timestamp=1375354762803, value=tariq                                                                  1 row(s) in 0.0300 seconds 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -