从hbase行检索时间戳 [英] Retrieving timestamp from hbase row

查看:644
本文介绍了从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()

这篇关于从hbase行检索时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆