Greetings folks-

I would like to restart the conversation on 
https://issues.apache.org/jira/browse/HBASE-7221 because there continue to be 
conversations on the dist-list about creating composite rowkeys, and while 
HBase makes just about anything possible, it doesn’t make much easy in this 
respect.

What I’m lobbying for is a utility class (see the v3 patch in HBASE-7221) that 
can both create and read rowkeys (so this isn’t just a one-way builder pattern).

This is currently stuck because it was noted that Bytes has an issue with 
sort-order of numbers specifically if you have both negative and positive 
values, which is really a different issue, but because this patch uses Bytes 
it’s related.

What are people’s thoughts on this topic in general, and the v3 version of the 
patch specifically?  (and the last set of comments).  Thanks!

One of the unit tests shows the example of usage.  The last set of comments 
suggested that RowKey be renamed FixedLengthRowKey, which I think is a good 
idea.  A follow-on patch could include VariableLengthRowKey for folks that use 
strings in the rowkeys.


  public void testCreate() throws Exception {

    int elements[] = {RowKeySchema.SIZEOF_MD5_HASH, RowKeySchema.SIZEOF_INT, 
RowKeySchema.SIZEOF_LONG};
    RowKeySchema schema = new RowKeySchema(elements);

    RowKey rowkey = schema.createRowKey();
    rowkey.setHash(0, hashVal);
    rowkey.setInt(1, intVal);
    rowkey.setLong(2, longVal);

    byte bytes[] = rowkey.getBytes();
    Assert.assertEquals("key length", schema.getRowKeyLength(), bytes.length);

    Assert.assertEquals("e1", rowkey.getInt(1), intVal);
    Assert.assertEquals("e2", rowkey.getLong(2), longVal);
  }

Doug Meil
Chief Software Architect, Explorys
doug.m...@explorys.com

Reply via email to