in flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mongodb/MongoDBType.java [75:106]
public static String jsonNodeToDorisType(JsonNode value) {
if (value instanceof IntNode) {
return DorisType.INT;
} else if (value instanceof TextNode) {
return DorisType.STRING;
} else if (value instanceof LongNode) {
return DorisType.BIGINT;
} else if (value instanceof DoubleNode) {
// When mongo double is in the JsonNode, it's actually a decimal type
return DorisType.DOUBLE;
} else if (value instanceof BooleanNode) {
return DorisType.BOOLEAN;
} else if (value instanceof ArrayNode) {
return DorisType.ARRAY + "<" + DorisType.STRING + ">";
} else if (value instanceof DecimalNode) {
return checkAndRebuildBigDecimal(value.decimalValue());
} else if (value instanceof ObjectNode) {
if (value.size() == 1 && value.get(DATE_FIELD) != null) {
return DorisType.DATETIME_V2 + "(3)";
} else if (value.size() == 1 && value.get(TIMESTAMP_FIELD) != null) {
return DorisType.DATETIME_V2 + "(0)";
} else if (value.size() == 1 && value.get(DECIMAL_FIELD) != null) {
return checkAndRebuildBigDecimal(new BigDecimal(value.get(DECIMAL_FIELD).asText()));
} else if (value.size() == 1 && value.get(LONG_FIELD) != null) {
return DorisType.BIGINT;
} else {
return DorisType.STRING;
}
} else {
return DorisType.STRING;
}
}