You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/11/12 02:37:17 UTC

[incubator-doris] branch master updated: [Bug] Fix NumberFormatException for partition cache (#6846)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 667e8bd  [Bug] Fix NumberFormatException for partition cache (#6846)
667e8bd is described below

commit 667e8bdce39c715d2339cc8b0105d65dfef9924e
Author: ChPi <ch...@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-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org