[
https://issues.apache.org/jira/browse/HBASE-7221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509726#comment-13509726
]
Doug Meil commented on HBASE-7221:
----------------------------------
re: "Interface looks good (so does this idea, generally)."
Thanks!
re: "At the same time everybody using HBase is building something like this,
so maybe HBase should ship with a reasonable set of default encodings."
This is precisely why I'm pushing this. Key construction a common question on
the dist-list, and HBase makes anything possible - but not much easy - in this
critical area.
re: "RowKey"
Change this class to FixedLengthRowKey?
There are a lot of situations that are handled by the v3 proposal, and I also
need to stress that this can not just create byte-arrays for keys, but also
read them back (that was an addition in the v3 patch). You can pass in a
rowkey when processing a table and then pick out the parts if needed (not
something that you can do with a builder).
re: other encodings
As for exotic coding, RowKey (referring to v3 name) does allow for a
setBytes(position, byte[]) for you to do the encoding yourself if you want. I
was picking the most common datatypes used in key-construction, but this does
not represent an exhaustive list.
There are plenty of advance cases that this doesn't handle, such as variable
length keys. I think a builder is probably better for that pattern.
> 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