KYLIN-2994 Handle NPE when load dict in DictionaryManager

Signed-off-by: Li Yang <[email protected]>


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

Branch: refs/heads/master
Commit: 280f6738b765aa32dbcdc50951777a8d30e6b489
Parents: ad3dd3f
Author: kangkaisen <[email protected]>
Authored: Mon Sep 11 14:59:15 2017 +0800
Committer: Li Yang <[email protected]>
Committed: Thu Dec 14 14:58:21 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/280f6738/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/280f6738/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) {

Reply via email to