for(int depth = 0; depth < criteria.getElements().size(); depth++) {
Field field = schema.getField(depth);
Field.Type type = field.getType();
SortElement sortElement = criteria.getElements().get(depth);
Order sort = sortElement.getOrder();
RawComparator comparator = sortElement.getCustomComparator();
if(comparator != null) {
//custom comparator for OBJECT
int length1 = WritableComparator.readVInt(b1, o.offset1);
int length2 = WritableComparator.readVInt(b2, o.offset2);
o.offset1 += WritableUtils.decodeVIntSize(b1[o.offset1]);
o.offset2 += WritableUtils.decodeVIntSize(b2[o.offset2]);
int comparison = comparator.compare(b1, o.offset1, length1, b2,
o.offset2, length2);
o.offset1 += length1;
o.offset2 += length2;
if(comparison != 0) {
return (sort == Order.ASC) ? comparison : -comparison;