@Override
  public int compareRows(final Cell left, final Cell right) {
    if (left instanceof ByteBufferExtendedCell) {
      ByteBufferExtendedCell bbLeft = (ByteBufferExtendedCell) left;
      if (right instanceof ByteBufferExtendedCell) {
        ByteBufferExtendedCell bbRight = (ByteBufferExtendedCell) right;
        return compareBBRows(bbLeft.getRowByteBuffer(), bbLeft.getRowPosition(),
          left.getRowLength(), bbRight.getRowByteBuffer(), bbRight.getRowPosition(),
          right.getRowLength());
      } else {
        return compareBBAndBytesRows(bbLeft.getRowByteBuffer(), bbLeft.getRowPosition(),
          left.getRowLength(), right.getRowArray(), right.getRowOffset(), right.getRowLength());
      }
    } else {
      if (right instanceof ByteBufferExtendedCell) {
        ByteBufferExtendedCell bbRight = (ByteBufferExtendedCell) right;
        return -compareBBAndBytesRows(bbRight.getRowByteBuffer(), bbRight.getRowPosition(),
          right.getRowLength(), left.getRowArray(), left.getRowOffset(), left.getRowLength());
      } else {
        return compareBytesRows(left.getRowArray(), left.getRowOffset(), left.getRowLength(),
          right.getRowArray(), right.getRowOffset(), right.getRowLength());
      }
    }
  }
A {@link MetaCellComparator} for <code>hbase:meta</code> catalog table {@link KeyValue}s.
hbase-common/src/main/java/org/apache/hadoop/hbase/MetaCellComparator.java