You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2017/12/12 09:19:29 UTC

[3/4] kylin git commit: KYLIN-2994 Handle NPE when load dict in DictionaryManager

KYLIN-2994 Handle NPE when load dict in DictionaryManager

Signed-off-by: Li Yang <li...@apache.org>


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

Branch: refs/heads/tmp
Commit: faad567c9fada55087f83dbf46556bbf6cc3527a
Parents: 38e71e1
Author: kangkaisen <ka...@meituan.com>
Authored: Mon Sep 11 14:59:15 2017 +0800
Committer: Li Yang <li...@apache.org>
Committed: Tue Dec 12 17:17:16 2017 +0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/kylin/dict/DictionaryManager.java  | 4 ++++
 .../org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java     | 5 +++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/faad567c/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
index e97899c..232f0ea 100755
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
@@ -115,6 +115,10 @@ public class DictionaryManager {
 
     public DictionaryInfo getDictionaryInfo(final String resourcePath) throws IOException {
         try {
+            //when all the value for this column is NULL, the resourcePath will be NULL
+            if (resourcePath == null) {
+                return NONE_INDICATOR;
+            }
             DictionaryInfo result = dictCache.get(resourcePath);
             if (result == NONE_INDICATOR) {
                 return null;

http://git-wip-us.apache.org/repos/asf/kylin/blob/faad567c/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java
index 2c85a28..255315a 100755
--- a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java
+++ b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapper.java
@@ -163,6 +163,11 @@ public class MergeCuboidMapper extends KylinMapper<Text, Text, Text, Text> {
                 DictionaryManager dictMgr = DictionaryManager.getInstance(config);
                 Dictionary<String> mergedDict = dictMgr.getDictionary(mergedCubeSegment.getDictResPath(col));
 
+                // handle the dict of all merged segments is null
+                if (mergedDict == null) {
+                    continue;
+                }
+
                 Dictionary<String> sourceDict;
                 // handle the column that all records is null
                 if (sourceCubeSegment.getDictionary(col) == null) {