You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Doug Meil <do...@explorysmedical.com> on 2009/10/26 13:12:24 UTC

Suggestion: .getTimestamp

Hi there-

I'd like to suggest a convenience method on Result for getting the timestamp of a value if it hasn't already been suggested before.

Getting the value is easy from a Result instance...

      byte b[] = r.getValue( Bytes.toBytes("family"), Bytes.toBytes("qualifier") );

... but getting the timestamp from KeyValue is a little tedious...

      KeyValue kv[] = r.raw();
      for (int j = 0; j < kv.length; j++) {

            String col = Bytes.toString( kv[j].getColumn() ) );
            // make sure you get the timestamp from the right column, etc etc.
            long ll = kv[j].getTimestamp();

(etc...)

Is it reasonable to have something like...

      long = r.getTimestamp( family, qualifier );

... ?


Doug Meil
Director of Engineering
doug.meil@explorys.net


Re: Suggestion: .getTimestamp

Posted by Jonathan Gray <jl...@streamy.com>.
Created HBASE-1937

https://issues.apache.org/jira/browse/HBASE-1937

Head over there to discuss this further.  Thanks.

JG

Doug Meil wrote:
> Hi there-
> 
> I'd like to suggest a convenience method on Result for getting the timestamp of a value if it hasn't already been suggested before.
> 
> Getting the value is easy from a Result instance...
> 
>       byte b[] = r.getValue( Bytes.toBytes("family"), Bytes.toBytes("qualifier") );
> 
> ... but getting the timestamp from KeyValue is a little tedious...
> 
>       KeyValue kv[] = r.raw();
>       for (int j = 0; j < kv.length; j++) {
> 
>             String col = Bytes.toString( kv[j].getColumn() ) );
>             // make sure you get the timestamp from the right column, etc etc.
>             long ll = kv[j].getTimestamp();
> 
> (etc...)
> 
> Is it reasonable to have something like...
> 
>       long = r.getTimestamp( family, qualifier );
> 
> ... ?
> 
> 
> Doug Meil
> Director of Engineering
> doug.meil@explorys.net
> 
> 

Re: Suggestion: .getTimestamp

Posted by Erik Holstad <er...@gmail.com>.
Hey Doug!
Looking at the code, this doesn't seem to be very hard at all to to, since
the time stamp and the value is a map entry and for
getValue() we just return the value and not the key, ts.

Please file a Jira

Regards Erik