You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Uli Köhler <ul...@online.de> on 2010/09/26 13:56:38 UTC

Lastest timestamp of a column

Hi all,
I have the following problem:
I've got a single column which is guaranteed to exist and I need to get the latest timestamp of this column
The only solution I found yet is:

result.getMap().get(INFO_CF).get(TITLE_KEY).lowerKey(Long.MAX_VALUE);

This looks quite ugly - and I'm pretty sure that it isn't very fast.

I'm using Cloudera's HBase 0.89.20100621+17.

I would be very grateful for any suggestions!

Best regards,
Uli Köhler

Re: Lastest timestamp of a column

Posted by Ryan Rawson <ry...@gmail.com>.
if you only are expecting 1 column in the result, then you can access
the KeyValue raw, eg:

KeyValue [] kvs = result.raw();
assert(kvs.length == 1);
KeyValue myKV = kvs[0];
byte[] row = myKV.getRow();
long timestamp = myKV.getTimestamp();

etc

The Result interface could probably use with a few more user friendly
APIs, do you have any ideas?

-ryan

On Sun, Sep 26, 2010 at 4:56 AM, Uli Köhler <ul...@online.de> wrote:
> Hi all,
> I have the following problem:
> I've got a single column which is guaranteed to exist and I need to get the
> latest timestamp of this column
> The only solution I found yet is:
>
> result.getMap().get(INFO_CF).get(TITLE_KEY).lowerKey(Long.MAX_VALUE);
>
> This looks quite ugly - and I'm pretty sure that it isn't very fast.
>
> I'm using Cloudera's HBase 0.89.20100621+17.
>
> I would be very grateful for any suggestions!
>
> Best regards,
> Uli Köhler
>