Retrieving timestamp from hbase row

Abhijeet Pathak picture Abhijeet Pathak · Nov 30, 2011 · Viewed 14.1k times · Source

Using Hbase API (Get/Put) or HBQL API, is it possible to retrieve timestamp of a particular column?

Answer

codingFoo picture codingFoo · Nov 30, 2011

Assuming your client is configured and you have a table setup. Doing a get returns a Result

Get get = new Get(Bytes.toBytes("row_key"));
Result result_foo = table.get(get);

A Result is backed by a KeyValue. KeyValues contain the timestamps. You can get either a list of KeyValues with list() or get an array with raw(). A KeyValue has a get timestamp method.

result_foo.raw()[0].getTimestamp()