从hbase行检索时间戳
问题描述:
使用Hbase API(Get / Put)或HBQL API,是否可以检索特定列的时间戳?
Using Hbase API (Get/Put) or HBQL API, is it possible to retrieve timestamp of a particular column?
答
假设您的客户端已配置,并且您有一个表设置。做一个get返回一个结果
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);
结果由 KeyValue 。 KeyValues包含时间戳。您可以使用list()获取KeyValues列表,或者使用raw()获取数组。 KeyValue有一个get timestamp方法。
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()