code: public static Comparator<Row> createComparator(final InputColumn<?> column, final int columnIndex) {
          final Class<?> dataType = column.getDataType();
          final boolean isNumber = dataType != null && ReflectionUtils.isNumber(dataType);
          final boolean isDate = dataType != null && ReflectionUtils.isDate(dataType);
  
          return (row1, row2) -> {
              final Comparable<?> value1 = getComparableValue(row1, columnIndex, isNumber, isDate);
              final Comparable<?> value2 = getComparableValue(row2, columnIndex, isNumber, isDate);
              final int comparableResult = CompareUtils.compareUnbound(value1, value2);
              if (comparableResult != 0) {
                  return comparableResult;
              } else {
                  // The values of the data at the row, and column to be
                  // sorted on are
                  // exactly the same. Now look at other values of all the
                  // columns to
                  // find if the two rows are same.
                  final int numberOfSelectItems = row1.getSelectItems().size();
                  for (int i = 0; i < numberOfSelectItems; i++) {
                      final String rowValue1 = (String) row1.getValue(i);
                      final String rowValue2 = (String) row2.getValue(i);
                      final int compareResult = rowValue1.compareToIgnoreCase(rowValue2);
                      if (compareResult == 0) {
                          continue;
                      } else {
                          return compareResult;
                      }
                  }
              }
  
              return comparableResult;
          };
      }
docs: Creates a comparator for the {@link InputColumn} based on its type
  (sorting numerically or lexicographically).
  
  @param column
  the column to sort on
  @param columnIndex
  the index of the column in the input {@link Row}
  @return the comparator instance