@Override
    public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
      int c = -1 * WritableComparator.compareBytes(b1, s1 + LENGTH_BYTES, l1 - LENGTH_BYTES, b2,
          s2 + LENGTH_BYTES, l2 - LENGTH_BYTES);
      return c;
    }
Compare the buffers in serialized form.
ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestTezTotalOrderPartitioner.java