[
https://issues.apache.org/jira/browse/HBASE-1937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770075#action_12770075
]
Jonathan Gray commented on HBASE-1937:
--------------------------------------
Right now there are two primary ways to get data out of a Result. You either
grab the KVs and iterate them directly, or you use one of the NavigableMaps.
The problem with the Maps are that they end up only containing a portion of the
data for each endpoint (for example, after getting to the value as Doug
describes, we can't determine the timestamp).
Maybe we could add a few methods like Result.getKeyValues(...) that returned a
subset of the total KVs, but would make more sense to someone and be easier to
deal with in clients.
For example:
{noformat}
// Return all keys in the specified family
KeyValue [] kvs = result.getKeyValues(family);
// Return all versions of the specified column
KeyValue [] kvs = result.getKeyValues(family, qualifier);
// Iterate versions of the column
for(KeyValue kv : kvs) {
byte [] value = kv.getValue();
long stamp = kv.getTimestamp();
}
{noformat}
> Add convenience method to Result for obtaining the timestamp of a column
> ------------------------------------------------------------------------
>
> Key: HBASE-1937
> URL: https://issues.apache.org/jira/browse/HBASE-1937
> Project: Hadoop HBase
> Issue Type: Improvement
> Components: client
> Affects Versions: 0.20.1
> Reporter: Jonathan Gray
> Priority: Minor
> Fix For: 0.21.0
>
>
> From Doug Meil on list:
> {quote}
> 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 );
> {quote}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.