JNSimba commented on code in PR #298: URL: https://github.com/apache/doris-flink-connector/pull/298#discussion_r1456741673
########## flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java: ########## @@ -144,8 +144,17 @@ public static String toDorisType(String type, Integer length, Integer scale) { return DorisType.DATE_V2; case DATETIME: case TIMESTAMP: - int dtScale = length > 19 ? length - 20 : 0; - return String.format("%s(%s)", DorisType.DATETIME_V2, Math.min(dtScale, 6)); + // default precision is 0 + if (length == null || length <= 0) { + return DorisType.DATETIME_V2; + // In JsonDebeziumSchemaSerializer record,the length of timestamp/datetime is 0 + // to 6. + } else if (length <= 6) { + return String.format("%s(%s)", DorisType.DATETIME_V2, length); + } else { + int dtScale = length > 19 ? length - 20 : 0; + return String.format("%s(%s)", DorisType.DATETIME_V2, Math.min(dtScale, 6)); Review Comment: what about length=7, Can we just write it like this : `Math.min(length > 19 ? length - 20 : length, 6)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org