shaofengshi closed pull request #206: KYLIN-3505 Fix wrong usage of cache in 
DataType
URL: https://github.com/apache/kylin/pull/206
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 d9eefb5d99..3dd1ed930e 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 static synchronized void registerComplex(String... 
typeNames) {
         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 static DataType getType(String type) {
         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;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to