zddr commented on code in PR #44911: URL: https://github.com/apache/doris/pull/44911#discussion_r1870719217
########## fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java: ########## @@ -152,4 +169,107 @@ public static ListPartitionItem toListPartitionItem(String partitionName, List<C ListPartitionItem listPartitionItem = new ListPartitionItem(Lists.newArrayList(key)); return listPartitionItem; } + + private static Type paimonPrimitiveTypeToDorisType(org.apache.paimon.types.DataType dataType) { + int tsScale = 3; // default + switch (dataType.getTypeRoot()) { + case BOOLEAN: + return Type.BOOLEAN; + case INTEGER: + return Type.INT; + case BIGINT: + return Type.BIGINT; + case FLOAT: + return Type.FLOAT; + case DOUBLE: + return Type.DOUBLE; + case SMALLINT: + return Type.SMALLINT; + case TINYINT: + return Type.TINYINT; + case VARCHAR: + case BINARY: + case CHAR: + case VARBINARY: + return Type.STRING; + case DECIMAL: + DecimalType decimal = (DecimalType) dataType; + return ScalarType.createDecimalV3Type(decimal.getPrecision(), decimal.getScale()); + case DATE: + return ScalarType.createDateV2Type(); + case TIMESTAMP_WITHOUT_TIME_ZONE: + if (dataType instanceof org.apache.paimon.types.TimestampType) { + tsScale = ((org.apache.paimon.types.TimestampType) dataType).getPrecision(); + if (tsScale > 6) { + tsScale = 6; + } + } else if (dataType instanceof org.apache.paimon.types.LocalZonedTimestampType) { + tsScale = ((org.apache.paimon.types.LocalZonedTimestampType) dataType).getPrecision(); + if (tsScale > 6) { + tsScale = 6; + } + } + return ScalarType.createDatetimeV2Type(tsScale); + case TIMESTAMP_WITH_LOCAL_TIME_ZONE: Review Comment: This is not a newly added method, it was copied from paimonExternalTable -- 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