AnsweredAssumed Answered

Accessing MapR table data from HIve based on Time Stamp

Question asked by rameshg on Mar 31, 2015
I have created a MapR table by mentioning the default versions as 10

    create '/hdfs/path/table name',{NAME => 'cf', VERSIONS => 10}

and inserted two rows(row1 and row2)

    put '/hdfs/path/tablename','row1','cf:id','row1id'
    put '/hdfs/path/tablename','row1','cf:name','row1name'
    put '/hdfs/path/tablename','row2','cf:id','row2id'
    put '/hdfs/path/tablename','row2','cf:name','row2name'
    put '/hdfs/path/tablename','row2','cf:name','row2nameupdate'
    put '/hdfs/path/tablename','row2','cf:name','row2nameupdateagain'
    put '/hdfs/path/tablename','row2','cf:name','row2nameupdateonemoretime'

Tried to select the data using scan

    scan '/hdfs/path/tablename',{RAW => true, VERSIONS => 10}

I'm able to see all the versions data.

Now created a Hive External table to pint to this MapR 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" = "/hdfs/path/tablename");

When I queried the table hive_timestampupdate I'm able to see the data in MapR table.

    select * from hive_timestampupdate;

Here I want to query the data based on timestamp. Is there a way to query the data based on timestamp of MapR table?

Any help will be appreciated.

Thanks in Advance.

 







Outcomes