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/24 14:03:17 UTC
[2/2] incubator-kylin git commit: KYLIN-855
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/fe569ac4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/fe569ac4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/fe569ac4
Branch: refs/heads/0.8
Commit: fe569ac4f66b879eae1f5db918a817f7d53329ff
Parents: db78899
Author: qianhao.zhou <qi...@ebay.com>
Authored: Wed Jun 24 19:22:56 2015 +0800
Committer: qianhao.zhou <qi...@ebay.com>
Committed: Wed Jun 24 20:01:56 2015 +0800
----------------------------------------------------------------------
.../apache/kylin/dict/DictionaryManager.java | 23 +++++++++++---------
1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/fe569ac4/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 d8b94b2..f4457ff 100644
--- a/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
+++ b/dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
@@ -42,6 +42,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@@ -308,20 +309,22 @@ public class DictionaryManager {
private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<?> dict) throws IOException {
ResourceStore store = MetadataManager.getInstance(config).getStore();
- ArrayList<String> existings = store.listResources(dictInfo.getResourceDir());
- if (existings == null)
+ ArrayList<String> dictInfos = store.listResources(dictInfo.getResourceDir());
+ if (dictInfos == null || dictInfos.isEmpty()) {
return null;
+ }
+ Collections.sort(dictInfos);
- for (String existing : existings) {
- logger.info("Checking dup dict :" + existing);
- DictionaryInfo existingInfo = load(existing, true); // skip cache, direct load from store
- if (existingInfo == null)
- logger.info("existingInfo is null");
+ final List<DictionaryInfo> allResources = MetadataManager.getInstance(config).getStore().getAllResources(dictInfos.get(0),
+ dictInfos.get(dictInfos.size() - 1),
+ DictionaryInfo.class,
+ DictionaryInfoSerializer.FULL_SERIALIZER);
- if (existingInfo != null && dict.equals(existingInfo.getDictionaryObject()))
- return existing;
+ for (DictionaryInfo dictionaryInfo : allResources) {
+ if (dict.equals(dictionaryInfo.getDictionaryObject())) {
+ return dictionaryInfo.getResourcePath();
+ }
}
-
return null;
}