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/21 10:49:18 UTC

[kylin] branch master updated: 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 master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new 2372b96  KYLIN-3505 Fix wrong usage of cache in DataType
2372b96 is described below

commit 2372b96ad3ab483591e68d184ad0ecc37507b78a
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 d9eefb5..3dd1ed9 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
@@ -124,7 +124,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");
 
@@ -142,10 +142,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;