[
https://issues.apache.org/jira/browse/HBASE-7221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509780#comment-13509780
]
Ian Varley commented on HBASE-7221:
-----------------------------------
Cool! Looks good, we do something similar internally (as I'm sure do most
shops). Definitely lots of room for making this experience more natural for
beginners, good on you Doug.
My first thought, like Lars, was: why are we "blessing" int, long & MD5 hash?
As opposed to setting bytes only, and having this class just help with the
arranging part? Sure, you can always just use the "setBytes/getBytes" methods
and ignore the other stuff, but I feel like adding specific types to the list
is a slippery slope (but I have no data to back that feeling up. :)
Questions it raises for me:
- As Lars mentioned, do you want to use standard ints, or binary comparable
like Lily does (where the sign's at the end)?
- What about Date objects? They'll be really common in row keys, of course.
But, they're also easy to change into a long.
- What about ways to indicate that something should be reverse ordered
(descending), via bit inversion?
If you stripped this down to just getByte(s)/setByte(s), would it still be
useful? Seems like that's got the lion's share of the pattern there. Maybe then
a subclass that adds common encodings (doing it as a subclass maybe makes it
more obvious that this is just one set of encodings, and anybody else can do
likewise).
Anyway, what you have seems straightforward enough that adding it might point
some people in the right direction, without getting too fancy.
Also, seems like this should go in the forthcoming hbase-client module, y?
Elliott, what's the timeline for that?
> 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,
> hbase-common_hbase_7221_v3.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