Book Image

Learning HBase

By : Shashwat Shriparv
Book Image

Learning HBase

By: Shashwat Shriparv

Overview of this book

Table of Contents (18 chapters)
Learning HBase
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Connecting HBase with Hive


We can map an HBase table to Hive (browse https://hive.apache.org if you don't know about Hive already) and run Hive queries that support Hive Query Language (HQL) almost in the same way as SQL on an HBase table. This is good for developers or users who possess a good knowledge of SQL.

For this, we need to create a table in HBase. Let's start the process:

Create a table in Hive as follows:

create 'hivehbasetable', 'name'

Put some data into it:

put 'hivehbasetable', 'row1', 'name:firstname', 'shashwat'
put 'hivehbasetable', 'row1', 'name:lastname', 'shriparv'
put 'hivehbasetable', 'row1', 'name:title', 'mr'

We need some JAR files for this association (Hive needs to be told where these JARs are), which are as follows:

  • Guava.<version>.jar

  • Hive-Hbase handler.<version>.jar

  • HBase.<version>.jar

  • Zookeeper.<version>.jar

Then, we will create an external table in Hive, which will map the HBase table to Hive. Start Hive with following command:

hive...