NoSQL

Hive not only provides a connection for data querying but also can map its external table to a NoSQL database, such as HBase or MongoDB, with various storage handlers.

To map an existing table in HBase, Hive uses the HBaseStorageHandler class in the table-creation statement. An example of creating a Hive external table mapping to an existing HBase is as follows:

> CREATE TABLE hbase_table_sample(
> id int,
> value1 string,
> value2 string,
> map_value map<string, string>
> )
> STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
> WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val,cf2:val,cf3")
> TBLPROPERTIES ("hbase.table.name" = "table_name_in_hbase");

In this special CREATE TABLE statement, the HBaseStorageHandler ...

Get Apache Hive Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.