You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by qh...@apache.org on 2015/06/25 07:37:34 UTC

incubator-kylin git commit: KYLIN-855

Repository: incubator-kylin
Updated Branches:
  refs/heads/0.8 bcea2a742 -> 249a500c3


KYLIN-855


Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/249a500c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/249a500c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/249a500c

Branch: refs/heads/0.8
Commit: 249a500c3039e8cc99be52b7f44200300d46095d
Parents: bcea2a7
Author: qianhao.zhou <qi...@ebay.com>
Authored: Thu Jun 25 11:16:37 2015 +0800
Committer: qianhao.zhou <qi...@ebay.com>
Committed: Thu Jun 25 13:36:44 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/dict/DictionaryManager.java | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/249a500c/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
----------------------------------------------------------------------
diff --git a/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java b/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
index f4457ff..cd72827 100644
--- a/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
+++ b/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
@@ -294,16 +294,23 @@ public class DictionaryManager {
     private String checkDupByInfo(DictionaryInfo dictInfo) throws IOException {
         ResourceStore store = MetadataManager.getInstance(config).getStore();
         ArrayList<String> existings = store.listResources(dictInfo.getResourceDir());
-        if (existings == null)
+        if (existings == null || existings.isEmpty()) {
             return null;
+        }
+        Collections.sort(existings);
+
+        final List<DictionaryInfo> allResources = MetadataManager.getInstance(config).getStore().getAllResources(existings.get(0),
+                existings.get(existings.size() - 1),
+                DictionaryInfo.class,
+                DictionaryInfoSerializer.INFO_SERIALIZER);
 
         TableSignature input = dictInfo.getInput();
-        for (String existing : existings) {
-            DictionaryInfo existingInfo = load(existing, false); // skip cache, direct load from store
-            if (input.equals(existingInfo.getInput()))
-                return existing;
-        }
 
+        for (DictionaryInfo dictionaryInfo : allResources) {
+            if (input.equals(dictionaryInfo.getInput())) {
+                return dictionaryInfo.getResourcePath();
+            }
+        }
         return null;
     }