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

Nick Dimiduk commented on HBASE-7692:
-------------------------------------

This implementation is mostly a superset of functionality described/requested 
in HBASE-7221. The example provided in that ticket's description is implemented 
using orderly like so:

{code}
StructRowKey rowkey = new StructBuilder()
  .add(new FixedByteArrayRowKey(16))
  .add(new LongRowKey())
  .toRowKey();
byte[] bytes = rowkey.serialize(new Object[] { a, b });
{code}

In this case, the hash operation must be supplied by the user.

Consuming the serialized bytes is pretty easy too. Here's an example of basic 
iteration:

{code}
rowkey.iterateOver(bytes);
for (Object f : rowkey) {
  System.out.println(f);
}
{code}

The attached patches includes a number of 
[examples|https://github.com/ndimiduk/hbase/tree/7692-ordered-serialization/hbase-examples/src/main/java/org/apache/hadoop/hbase/orderly].

(cc [~dmeil], [~lhofhansl])
                
> Add utility class to generate ordered byte[] serialization
> ----------------------------------------------------------
>
>                 Key: HBASE-7692
>                 URL: https://issues.apache.org/jira/browse/HBASE-7692
>             Project: HBase
>          Issue Type: Improvement
>          Components: util
>            Reporter: Nick Dimiduk
>            Assignee: Nick Dimiduk
>         Attachments: HBASE-7692.v1.patch, HBASE-7692.v2.patch, 
> HBASE-7692.v3.patch, HBASE-7692.v4.patch
>
>
> The current Bytes utility class works, but produces output that does not 
> maintain the native sort ordering of the input value. This results in, for 
> example, a negative value that does not necessarily sort before a positive 
> value. HBase should provide a canonical implementation of such a 
> serialization format so that third-parties can reliably build on top of 
> HBase. This will allow an implementation for HIVE-3634, HIVE-2599, or 
> HIVE-2903 that is compatible with similar features in Pig.

--
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

Reply via email to