Quantcast
Channel: Hortonworks » All Replies
Viewing all articles
Browse latest Browse all 3435

HBase Hive Integration

$
0
0

I have created a HBase by mentioning the default versions as 5

create ‘tablename’,{NAME => ‘cf’, VERSIONS => 5}
and inserted two rows(row1 and row2)

put ‘tablename’,’row1′,’cf:id’,’row1id’
put ‘tablename’,’row1′,’cf:name’,’row1name’
put ‘tablename’,’row2′,’cf:id’,’row2id’
put ‘tablename’,’row2′,’cf:name’,’row2name’
put ‘tablename’,’row2′,’cf:name’,’row2nameupdate’
put ‘tablename’,’row2′,’cf:name’,’row2nameupdateagain’

Tried to select the data by using scan and I’m getting the latest updated data.
and when I tried to select the different versions data by using the below command I got the different versions data.

scan ‘tablename’,{RAW => true, VERSIONS => 5}

Now created a Hive External table to point to this HBase table

CREATE EXTERNAL TABLE hive_timestampupdate(key int, value string)
STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler’
WITH SERDEPROPERTIES (“hbase.columns.mapping” = “:key,cf:name”)
TBLPROPERTIES (“hbase.table.name” = “tablename”);

select * from hive_timestampupdate

When I queried the table hive_timestampupdate, I’m able to see the data.

By default here I’m getting the latest updated data based on timestamp.
Here also I want to query the data of different versions.

**Hive command that will fetch the different versions data of HBase.**

Any help please.

Thanks in Advance.


Viewing all articles
Browse latest Browse all 3435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>