You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Jim Kellerman (JIRA)" <ji...@apache.org> on 2008/08/11 18:32:45 UTC

[jira] Commented: (HBASE-802) RowResult containing or supporting more flexible data structures to access elements returned

    [ https://issues.apache.org/jira/browse/HBASE-802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12621493#action_12621493 ] 

Jim Kellerman commented on HBASE-802:
-------------------------------------

You could also do:

{code}
for (Map.Entry<byte[], Cell> e: cols.entrySet()) {
  ...
}
{code}


> RowResult containing or supporting more flexible data structures to access elements returned
> --------------------------------------------------------------------------------------------
>
>                 Key: HBASE-802
>                 URL: https://issues.apache.org/jira/browse/HBASE-802
>             Project: Hadoop HBase
>          Issue Type: New Feature
>          Components: io
>    Affects Versions: 0.2.0
>            Reporter: Jonathan Gray
>             Fix For: 0.3.0
>
>
> Extracting actual data from a RowResult can be an ugly process when you don't know what you're looking for (to be able to query the Map).
> For example, if i want to get all columns in a family, or I pass a large number of columns each of which may or may not exist in the specified row, I need to go through the entire list of column/Cells.  Currently this is done with something like:
> RowResult result = HTable.getRow(rowkey,columns)
> Set<Map.Entry<byte [], Cell>> cols = result.entrySet();
> From here I know how many entries are in the Set (cols.size()), but if I want to go through them, this requires another step change the Set into an Array or an Iterator.
> Iterator<Map.Entry<byte [], Cell>> iterator = cols.iterator();
> or
> Map.Entry<byte [], Cell> [] entries = cols.toArray(new RowResult.Entry[0])
> So going from what is returned from HBase, into something usable by the client, requires at least two additional lines and data structure conversions.  The Map -> Set<Map.Entry> is very likely to be fast.  I'm unsure about the speed of the Iterator or toArray.  I would guess that the change to Iterator is fairly efficient (not requiring a copy of the memory), whereas toArray likely does.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.