0
votes

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.

1
Someone posted spam as an "answer" to this question some time before I wrote this comment. That's why the Q is protected.dorukayhan

1 Answers

1
votes

From the https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration

there is currently no way to access the HBase timestamp attribute, and queries always access data with the latest timestamp.