public void addColumnComparator(int keyIndex, int columnTypeSpecificIndex, ColumnVector.Type columnVectorType,
                                  char sortOrder, char nullOrder) {
    Comparator<VectorHashKeyWrapperBase> comparator;
    switch (columnVectorType) {
    case LONG:
    case DECIMAL_64:
      comparator = (o1, o2) ->
              Long.compare(o1.getLongValue(columnTypeSpecificIndex), o2.getLongValue(columnTypeSpecificIndex));
      break;
    case DOUBLE:
      comparator = (o1, o2) -> Double.compare(
              o1.getDoubleValue(columnTypeSpecificIndex), o2.getDoubleValue(columnTypeSpecificIndex));
      break;
    case BYTES:
      comparator = (o1, o2) -> StringExpr.compare(
              o1.getBytes(columnTypeSpecificIndex),
              o1.getByteStart(columnTypeSpecificIndex),
              o1.getByteLength(columnTypeSpecificIndex),
              o2.getBytes(columnTypeSpecificIndex),
              o2.getByteStart(columnTypeSpecificIndex),
              o2.getByteLength(columnTypeSpecificIndex));
      break;
    case DECIMAL:
      comparator = (o1, o2) ->
              o1.getDecimal(columnTypeSpecificIndex).compareTo(o2.getDecimal(columnTypeSpecificIndex));
      break;
    case TIMESTAMP:
      comparator = (o1, o2) ->
              o1.getTimestamp(columnTypeSpecificIndex).compareTo(o2.getTimestamp(columnTypeSpecificIndex));
      break;
    case INTERVAL_DAY_TIME:
      comparator = (o1, o2) -> o1.getIntervalDayTime(columnTypeSpecificIndex)
              .compareTo(o2.getIntervalDayTime(columnTypeSpecificIndex));
      break;
    default:
      throw new RuntimeException("Unexpected column vector columnVectorType " + columnVectorType);
    }
    comparators[keyIndex] = (
            new VectorHashKeyWrapperBaseComparator(
                    keyIndex,
                    sortOrder == '-' ? comparator.reversed() : comparator,
                    nullOrder));
  }
Compare {@link VectorHashKeyWrapperBase} instances only by one column.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/wrapper/VectorHashKeyWrapperGeneralComparator.java