This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-0.15 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit c53c00635b72edc5522a83ed5f4411f5ce5a83d8 Author: ChPi <chji...@gmail.com> AuthorDate: Fri Nov 12 10:36:58 2021 +0800 [Bug] Fix NumberFormatException for partition cache (#6846) Fix #6845 --- .../org/apache/doris/qe/cache/PartitionRange.java | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java index 91e393e..5f815bd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java @@ -27,7 +27,6 @@ import org.apache.doris.analysis.LiteralExpr; import org.apache.doris.analysis.IntLiteral; import org.apache.doris.catalog.OlapTable; import org.apache.doris.catalog.PartitionItem; -import org.apache.doris.catalog.PrimitiveType; import org.apache.doris.catalog.RangePartitionInfo; import org.apache.doris.catalog.Column; import org.apache.doris.catalog.Partition; @@ -149,17 +148,26 @@ public class PartitionRange { public Date date; public boolean init(Type type, String str) { - if (type.getPrimitiveType() == PrimitiveType.DATE) { - try { - date = df10.parse(str); - } catch (Exception e) { - LOG.warn("parse error str{}.", str); + switch (type.getPrimitiveType()) { + case DATE: + try { + date = df10.parse(str); + } catch (Exception e) { + LOG.warn("parse error str{}.", str); + return false; + } + keyType = KeyType.DATE; + break; + case TINYINT: + case SMALLINT: + case INT: + case BIGINT: + value = Long.parseLong(str); + keyType = KeyType.LONG; + break; + default: + LOG.info("PartitionCache not support such key type {}", type.toSql()); return false; - } - keyType = KeyType.DATE; - } else { - value = Long.valueOf(str); - keyType = KeyType.LONG; } return true; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org