You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/08/22 08:53:23 UTC

[kylin] 01/02: KYLIN-3505 Fix wrong usage of cache in DataType

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

shaofengshi pushed a commit to branch 2.4.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit a398fb2ea3280c4f364a3a139bd5e6ce80dc0b4f
Author: ian4hu <hu...@163.com>
AuthorDate: Tue Aug 21 17:23:19 2018 +0800

    KYLIN-3505 Fix wrong usage of cache in DataType
---
 .../main/java/org/apache/kylin/metadata/datatype/DataType.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
index 5ccc1f3..1b105f7 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
@@ -126,7 +126,7 @@ public class DataType implements Serializable {
         LEGACY_TYPE_MAP.put("hllc16", "hllc(16)");
     }
 
-    private static final ConcurrentMap<DataType, DataType> CACHE = new ConcurrentHashMap<DataType, DataType>();
+    private static final ConcurrentMap<String, DataType> CACHE = new ConcurrentHashMap<String, DataType>();
 
     public static final DataType ANY = DataType.getType("any");
 
@@ -144,10 +144,10 @@ public class DataType implements Serializable {
         if (type == null)
             return null;
 
-        DataType dataType = new DataType(type);
-        DataType cached = CACHE.get(dataType);
+        DataType cached = CACHE.get(type);
         if (cached == null) {
-            CACHE.put(dataType, dataType);
+            DataType dataType = new DataType(type);
+            CACHE.put(type, dataType);
             cached = dataType;
         }
         return cached;