JingsongLi commented on a change in pull request #12010: URL: https://github.com/apache/flink/pull/12010#discussion_r422027026
########## File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PartitionPathUtils.java ########## @@ -201,6 +210,50 @@ public static String unescapePathName(String path) { return ret; } + /** + * Restore partition value from string and type. + * + * @param valStr string partition value. + * @param type type of partition field. + * @return partition value. + */ + public static Object restorePartValueFromType(String valStr, DataType type) { + if (valStr == null) { + return null; + } + + LogicalTypeRoot typeRoot = type.getLogicalType().getTypeRoot(); + switch (typeRoot) { + case CHAR: + case VARCHAR: + return StringData.fromString(valStr); + case BOOLEAN: + return Boolean.parseBoolean(valStr); + case TINYINT: + return Byte.parseByte(valStr); + case SMALLINT: + return Short.parseShort(valStr); + case INTEGER: + return Integer.parseInt(valStr); + case BIGINT: + return Long.parseLong(valStr); + case FLOAT: + return Float.valueOf(valStr).floatValue(); Review comment: why `floatValue `? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org