conf.set(CRUNCH_ORDERING_PROPERTY, Joiner.on(",").join(ordering));
}
@Override
public int compare(WritableComparable a, WritableComparable b) {
TupleWritable ta = (TupleWritable) a;
TupleWritable tb = (TupleWritable) b;
for (int index = 0; index < columnOrders.length; index++) {
int order = 1;
if (columnOrders[index].order() == Order.ASCENDING) {
order = 1;
} else if (columnOrders[index].order() == Order.DESCENDING) {
order = -1;
} else { // ignore
continue;
}
if (!ta.has(index) && !tb.has(index)) {
continue;
} else if (ta.has(index) && !tb.has(index)) {
return order;
} else if (!ta.has(index) && tb.has(index)) {
return -order;
} else {
BytesWritable v1 = ta.get(index);
BytesWritable v2 = tb.get(index);
if (v1 != v2 && (v1 != null && !v1.equals(v2))) {
try {
w1[index].readFields(new DataInputStream(new ByteArrayInputStream(v1.getBytes())));
w2[index].readFields(new DataInputStream(new ByteArrayInputStream(v2.getBytes())));
} catch (IOException e) {