How to fetch HBase table data in Apache Phoenix?

Hadoop   |   
Published October 17, 2016   |   

This exclusive post is shared by big data services providers to help developers in development. They tell the best way to fetch HBase table data in Apache Phoenix. Read this article and discover what they have to say about Big Data related services.

The term ‘Big Data’ has been continuously in the limelight from quite some time now. It would not be exaggerating the term by saying it contains all the data which can define one behavior with respect to everything in the world and that’s the reason it increasing exponentially and centre of attraction of many articles, meetings, and conferences.

Now we have to see that a big data will leave big impact or not. Nowadays many applications working in Data Analytics and Data mining using BigData at their core, and constantly attempting to get the better prediction. Those who are making decision want to study the patterns what happened in the past and what’s happening in the present in order to predict what’s going to hit in the future.

As Hadoop offers the complete framework — specifically for customers who want to prepare the Data lake from the Data Warehouse or Data Mart followed by the Data analytics with the help of Apache SparkMlib, we can see much improvement towards the predictions as compared to the previous-generation methods.

Technology:

We all know that HBase is the NoSql database for the Hadoop ecosystem and working very well in that area but there is one limitation of the HBase is that it is not very user friendly for SQL developer, to overcome this limitation with the Apache HBase they come up with the SQL skin above HBase known as  Apache Phoenix.

While working with HBase-Phoenix integration, we come up with one strange behaviour of Phoenix and thought to share it with you.

Use-case:

Below is the table we have created in Apache Phoenix named ‘test_1’ with 2 columns.

Apache Phoenix
Inserted few rows into it manually.

Inserted rows in Apache Phoenix
Verified the same.

Apache Phoenix verify the same number of rows

Now as per the integration structure of the HBase and Phoenix, the table we have created in above should get reflected in HBase with the same data.

We have verified the same, table has been created in HBase with the same name (test_1) and we have verified the data that would be placed correctly.

Hbase main

Now we have tested the same procedure another way round – we will create the table in HBase, load data into it and check for the same in Phoenix.

We have created the table in HBase with name ‘TEST_2’

HBase with name Test_2
Inserted 3 rows into it.

Apache Phoenix(Insert rows)

Verify the same with the SCAN command.

Scan command

 Issue:

We have searched for the same table in Phoenix that we have created in HBase but the table is not present over theirs.

It’s actually a limitation of Phoenix that it will not pick up the table details automatically from HBase metadata.

Phoenix issue

Resolution: 

We have to create the table manually in Phoenix with the same name with which we have created in HBase (TEST_2).

Phoenix resolution

Once the table is created with the same name, it will automatically fetch the data from the HBase metadata and reflect the same into Phoenix table.

Apache phoenix 1

JDBC phoenix 2

This post is intended by Big Data services experts to make you learn about the fetching process for HBase table data in Apache Phoenix. If there is anything you want to ask, write in comments. 

Conclusion:

We found that when we create table in Phoenix and load the data into it, then the same data will reflect in the HBase under the table with the same name but when we attempt vice-versa and create table in HBase and load data into it, same will NOT be reflected in Phoenix table and we have to manually map the Phoenix table with HBase table.