Paul Sutter wrote:
How can I define a comparator that can compare raw binary data? (our keys
are raw binary data)

Implement the following method:

http://lucene.apache.org/hadoop/docs/api/org/apache/hadoop/io/WritableComparator.html#compare(byte[],%20int,%20int,%20byte[],%20int,%20int)

To make a comparator the default for a class, call:

http://lucene.apache.org/hadoop/docs/api/org/apache/hadoop/io/WritableComparator.html#define(java.lang.Class,%20org.apache.hadoop.io.WritableComparator)

This is already done for most WritableComparable implementations. The the bottom of, e.g., IntWritable.java for an example of the idiom.

http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/IntWritable.java?view=markup

Doug

Reply via email to