public static DataType toFlinkType()

in flink-doris-connector/src/main/java/org/apache/doris/flink/catalog/DorisTypeMapper.java [85:142]


    public static DataType toFlinkType(
            String columnName, String columnType, int precision, int scale) {
        columnType = columnType.toUpperCase();
        switch (columnType) {
            case BOOLEAN:
                return DataTypes.BOOLEAN();
            case TINYINT:
                if (precision == 0) {
                    // The boolean type will become tinyint when queried in information_schema, and
                    // precision=0
                    return DataTypes.BOOLEAN();
                } else {
                    return DataTypes.TINYINT();
                }
            case SMALLINT:
                return DataTypes.SMALLINT();
            case INT:
                return DataTypes.INT();
            case BIGINT:
                return DataTypes.BIGINT();
            case DECIMAL:
            case DECIMAL_V3:
                return DataTypes.DECIMAL(precision, scale);
            case FLOAT:
                return DataTypes.FLOAT();
            case DOUBLE:
                return DataTypes.DOUBLE();
            case CHAR:
                return DataTypes.CHAR(precision);
            case VARCHAR:
                return DataTypes.VARCHAR(precision);
            case LARGEINT:
            case BIGINT_UNSIGNED:
            case STRING:
            case JSONB:
            case JSON:
                // Currently, the subtype of the generic cannot be obtained,
                // so it is mapped to string
            case ARRAY:
            case MAP:
            case STRUCT:
            case IPV4:
            case IPV6:
            case VARIANT:
                return DataTypes.STRING();
            case DATE:
            case DATE_V2:
                return DataTypes.DATE();
            case DATETIME:
            case DATETIME_V2:
                return DataTypes.TIMESTAMP(scale);
            default:
                throw new UnsupportedOperationException(
                        String.format(
                                "Doesn't support Doris type '%s' on column '%s'",
                                columnType, columnName));
        }
    }