Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - Mapping HBase table in Hive

Copy link to this message
Mapping HBase table in Hive
Ibrahim Yakti 2013-01-08, 12:45

suppose I have the following table (orders) in MySQL:

*************************** 1. row ***************************
  Field: id
   Type: int(10) unsigned
   Null: NO
    Key: PRI
Default: NULL
  Extra: auto_increment
*************************** 2. row ***************************
  Field: value
   Type: int(10) unsigned
   Null: NO
Default: NULL
*************************** 3. row ***************************
  Field: date_lastchange
   Type: timestamp
   Null: NO
  Extra: on update CURRENT_TIMESTAMP
*************************** 4. row ***************************
  Field: date_inserted
   Type: timestamp
   Null: NO
Default: 0000-00-00 00:00:00

I imported it into HBase with column family "id"

I want to create an external table in Hive to query the HBase table, I am
not able to get the mapping parameters (*hbase.columns.mapping*), it is
confusing, if anybody can explain it to me please. I used the following

CREATE EXTERNAL TABLE hbase_orders(id bigint, value bigint, date_lastchange
string, date_inserted string) STORED BY
'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES
("hbase.columns.mapping" = " ? ? ? ? ? ?") TBLPROPERTIES ("hbase.table.name"
= "orders");

Is there any way to build the Hive tables automatically or I should go with
the same process with each table?
Thanks in advanced.

bejoy_ks@... 2013-01-08, 18:35
Ibrahim Yakti 2013-01-13, 08:22
bejoy_ks@... 2013-01-13, 09:23
Ibrahim Yakti 2013-01-13, 11:33