KYLIN-2433 Handle the column that all records is null in MergeCuboidMapper
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/a5326fcb Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/a5326fcb Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/a5326fcb Branch: refs/heads/master-hbase0.98 Commit: a5326fcb5a670970ee20b08486a77ec02dcf5c66 Parents: 69f8984 Author: kangkaisen <kangkai...@163.com> Authored: Tue Feb 14 11:29:23 2017 +0800 Committer: kangkaisen <kangkai...@163.com> Committed: Tue Feb 14 17:50:26 2017 +0800 ---------------------------------------------------------------------- .../kylin/engine/mr/steps/MergeCuboidMapper.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/a5326fcb/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 acf1403..fccd48a 100644 --- 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 @@ -191,9 +191,18 @@ public class MergeCuboidMapper extends KylinMapper<Text, Text, Text, Text> { if (this.checkNeedMerging(col)) { // if dictionary on fact table column, needs rewrite DictionaryManager dictMgr = DictionaryManager.getInstance(config); - Dictionary<String> sourceDict = dictMgr.getDictionary(sourceCubeSegment.getDictResPath(col)); Dictionary<String> mergedDict = dictMgr.getDictionary(mergedCubeSegment.getDictResPath(col)); + Dictionary<String> sourceDict; + // handle the column that all records is null + if (sourceCubeSegment.getDictionary(col) == null) { + BytesUtil.writeUnsigned(mergedDict.nullId(), newKeyBodyBuf, bufOffset, mergedDict.getSizeOfId()); + bufOffset += mergedDict.getSizeOfId(); + continue; + } else { + sourceDict = dictMgr.getDictionary(sourceCubeSegment.getDictResPath(col)); + } + while (sourceDict.getSizeOfValue() > newKeyBodyBuf.length - bufOffset || // mergedDict.getSizeOfValue() > newKeyBodyBuf.length - bufOffset || // mergedDict.getSizeOfId() > newKeyBodyBuf.length - bufOffset) { @@ -254,11 +263,6 @@ public class MergeCuboidMapper extends KylinMapper<Text, Text, Text, Text> { } private Boolean checkNeedMerging(TblColRef col) throws IOException { - //handle the column that all records is null - if (sourceCubeSegment.getDictionary(col) == null) { - return false; - } - Boolean ret = dimensionsNeedDict.get(col); if (ret != null) return ret;