Database Reference
In-Depth Information
Using Impala to query HBase tables
While querying HBase tables, Impala uses the HBase client API to query data stored
in HBase. You can create external tables in Hive with or without the string key. Here
is an example of creating a table first in HBase and then in Hive for mapping, and
finally, querying it in Impala:
1. Create the HBase table in the HBase shell as follows:
Create 'hbasetable', 'ints', 'strings'
Enable 'hbasetable'
2. Create an external table in the Hive shell with a string row key as follows:
CREATE EXTERNAL TABLE
hivetableforhbase_userid (
UserId string, /* Row Key is set
as String */
UserName string, UserAge int,
UserDob timestamp)
STORED BY
'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES (
"hbase.columns.mapping" =
":key,strings:UserID,strings:UserName,ints:UserAge,strings:UserBob
)
TBLPROPERTIES("hbase.table.name" =
"hivetableforhbaseuseragg");
3. You can also create another table without a string row key for learning pur-
poses as follows:
CREATE EXTERNAL TABLE hivetableforhbase (
UserId int, /* Row Key is not set
as String */
UserName string, UserAge int,
UserDob timestamp)
STORED BY
'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
Search WWH ::




Custom Search