Repository: kylin
Updated Branches:
  refs/heads/master 76dc04971 -> a2af43d40


KYLIN-3205 Allow one column is used for both dimension and precisely count 
distinct measure

Signed-off-by: shaofengshi <shaofeng...@apache.org>


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

Branch: refs/heads/master
Commit: a2af43d409fb6493b43b7cb525d0e8884e2d5828
Parents: 76dc049
Author: kangkaisen <kangkai...@meituan.com>
Authored: Sun Dec 31 16:51:05 2017 +0800
Committer: shaofengshi <shaofeng...@apache.org>
Committed: Sun Feb 4 21:08:13 2018 +0800

----------------------------------------------------------------------
 .../kylin/cube/model/validation/rule/DictionaryRule.java       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a2af43d4/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/DictionaryRule.java
----------------------------------------------------------------------
diff --git 
a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/DictionaryRule.java
 
b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/DictionaryRule.java
index 8da3ca0..df1316d 100644
--- 
a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/DictionaryRule.java
+++ 
b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/DictionaryRule.java
@@ -26,6 +26,7 @@ import java.util.Set;
 import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.cube.model.CubeDesc;
 import org.apache.kylin.cube.model.DictionaryDesc;
+import org.apache.kylin.cube.model.RowKeyDesc;
 import org.apache.kylin.cube.model.validation.IValidatorRule;
 import org.apache.kylin.cube.model.validation.ResultLevel;
 import org.apache.kylin.cube.model.validation.ValidateContext;
@@ -46,12 +47,13 @@ public class DictionaryRule implements 
IValidatorRule<CubeDesc> {
     static final String ERROR_REUSE_BUILDER_BOTH_SET = "REUSE and BUILDER both 
set on dictionary for column: ";
     static final String ERROR_REUSE_BUILDER_BOTH_EMPTY = "REUSE and BUILDER 
both empty on dictionary for column: ";
     static final String ERROR_TRANSITIVE_REUSE = "Transitive REUSE is not 
allowed for dictionary: ";
-    static final String ERROR_GLOBAL_DICTIONNARY_ONLY_MEASURE = "Global 
dictionary couldn't be used for dimension column: ";
+    static final String ERROR_GLOBAL_DICTIONNARY_ONLY_MEASURE = "If one column 
is used for both dimension and precisely count distinct measure, its dimension 
encoding should not be dict: ";
 
     @Override
     public void validate(CubeDesc cubeDesc, ValidateContext context) {
         List<DictionaryDesc> dictDescs = cubeDesc.getDictionaries();
         Set<TblColRef> dimensionColumns = 
cubeDesc.listDimensionColumnsIncludingDerived();
+        RowKeyDesc rowKeyDesc = cubeDesc.getRowkey();
 
         if (dictDescs == null || dictDescs.isEmpty()) {
             return;
@@ -82,7 +84,7 @@ public class DictionaryRule implements 
IValidatorRule<CubeDesc> {
                 return;
             }
 
-            if (StringUtils.isNotEmpty(builderClass) && 
builderClass.equalsIgnoreCase(GlobalDictionaryBuilder.class.getName()) && 
dimensionColumns.contains(dictCol)) {
+            if (StringUtils.isNotEmpty(builderClass) && 
builderClass.equalsIgnoreCase(GlobalDictionaryBuilder.class.getName()) && 
dimensionColumns.contains(dictCol) && rowKeyDesc.isUseDictionary(dictCol)) {
                 context.addResult(ResultLevel.ERROR, 
ERROR_GLOBAL_DICTIONNARY_ONLY_MEASURE + dictCol);
                 return;
             }

Reply via email to