hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Meil (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-7221) RowKey utility class for rowkey construction
Date Thu, 29 Nov 2012 21:18:58 GMT

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

Doug Meil commented on HBASE-7221:

re:  "Builder"

Yeah, I really wasn't going for a builder pattern.  Elliott had a concern about the name "RowKey"
(I must admit I'm still partial to it because there isn't a class with that name anywhere
in the codebase).

I wasn't really aiming for a builder pattern in the first place because I didn't want to necessarily
force people to destroy and re-create the RowKey/Builder for each rowkey they create - that's
why the reset method is there.  The only thing that would have to get reset was the backing
byte array.

re:  "fixed size"

I wanted any particular instance to have a fixed size so that the backing byte-array didn't
have resize like an ArrayList (and wind up burning a lot of byte-arrays in the process). 
So it's "easier" to create rowkeys than without the utility, but not without required thought.
If your table had multiple length keys, there's nothing wrong with creating 2 different instances,
one for each length.

That's where I was coming from.

re:  "formatting"

I'll fix that.  Doh!  


> RowKey utility class for rowkey construction
> --------------------------------------------
>                 Key: HBASE-7221
>                 URL: https://issues.apache.org/jira/browse/HBASE-7221
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Doug Meil
>            Assignee: Doug Meil
>            Priority: Minor
>         Attachments: HBASE_7221.patch, hbase-common_hbase_7221_2.patch
> A common question in the dist-lists is how to construct rowkeys, particularly composite
keys.  Put/Get/Scan specifies byte[] as the rowkey, but it's up to you to sensibly populate
that byte-array, and that's where things tend to go off the rails.
> The intent of this RowKey utility class isn't meant to add functionality into Put/Get/Scan,
but rather make it simpler for folks to construct said arrays.  Example:
> {code}
>    RowKey key = RowKey.create(RowKey.SIZEOF_MD5_HASH + RowKey.SIZEOF_LONG);
>    key.addHash(a);
>    key.add(b);
>    byte bytes[] = key.getBytes();
> {code} 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message