public int compareTo()

in spark-load/spark-load-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/DppColumns.java [43:83]


    public int compareTo(DppColumns other) {
        Preconditions.checkState(columns.size() == other.columns.size());

        int cmp = 0;
        for (int i = 0; i < columns.size(); i++) {
            Object columnObj = columns.get(i);
            Object otherColumn = other.columns.get(i);
            if (columnObj == null && otherColumn == null) {
                return 0;
            } else if (columnObj == null || otherColumn == null) {
                if (columnObj == null) {
                    return -1;
                } else {
                    return 1;
                }
            }
            if (columns.get(i) instanceof Integer) {
                cmp = ((Integer) (columns.get(i))).compareTo((Integer) (other.columns.get(i)));
            } else if (columns.get(i) instanceof Long) {
                cmp = ((Long) (columns.get(i))).compareTo((Long) (other.columns.get(i)));
            }  else if (columns.get(i) instanceof  Boolean) {
                cmp = ((Boolean) (columns.get(i))).compareTo((Boolean) (other.columns.get(i)));
            } else if (columns.get(i) instanceof  Short) {
                cmp = ((Short) (columns.get(i))).compareTo((Short) (other.columns.get(i)));
            } else if (columns.get(i) instanceof  Float) {
                cmp = ((Float) (columns.get(i))).compareTo((Float) (other.columns.get(i)));
            } else if (columns.get(i) instanceof Double) {
                cmp = ((Double) (columns.get(i))).compareTo((Double) (other.columns.get(i)));
            } else if (columns.get(i) instanceof Date) {
                cmp = ((Date) (columns.get(i))).compareTo((Date) (other.columns.get(i)));
            } else if (columns.get(i) instanceof java.sql.Timestamp) {
                cmp = ((java.sql.Timestamp) columns.get(i)).compareTo((java.sql.Timestamp) other.columns.get(i));
            } else {
                cmp = ((String) (columns.get(i))).compareTo((String) (other.columns.get(i)));
            }
            if (cmp != 0) {
                return cmp;
            }
        }
        return cmp;
    }