minor, disallow empty joint and hierarchy groups
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/4d2a548a Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/4d2a548a Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/4d2a548a Branch: refs/heads/master Commit: 4d2a548accba5aa70ad7c2bcc405882a44fe9aae Parents: 361b58d Author: lidongsjtu <[email protected]> Authored: Mon Jun 19 18:50:56 2017 +0800 Committer: Roger Shi <[email protected]> Committed: Mon Jun 19 18:56:33 2017 +0800 ---------------------------------------------------------------------- .../java/org/apache/kylin/cube/model/CubeDesc.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/4d2a548a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java index 4318570..91f985c 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java @@ -707,11 +707,11 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware { throw new IllegalStateException("Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions: " + ensureOrder(CollectionUtils.intersection(hierarchyDims, jointDims))); } - if (hasSingle(hierarchyDimsList)) { + if (hasSingleOrNone(hierarchyDimsList)) { logger.error("Aggregation group " + index + " require at least 2 dimensions in a hierarchy"); throw new IllegalStateException("Aggregation group " + index + " require at least 2 dimensions in a hierarchy."); } - if (hasSingle(jointDimsList)) { + if (hasSingleOrNone(jointDimsList)) { logger.error("Aggregation group " + index + " require at least 2 dimensions in a joint"); throw new IllegalStateException("Aggregation group " + index + " require at least 2 dimensions in a joint"); } @@ -753,15 +753,15 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware { } } - private boolean hasSingle(ArrayList<Set<String>> dimsList) { - boolean hasSingle = false; + private boolean hasSingleOrNone(ArrayList<Set<String>> dimsList) { + boolean hasSingleOrNone = false; for (Set<String> dims : dimsList) { - if (dims.size() == 1) { - hasSingle = true; + if (dims.size() <= 1) { + hasSingleOrNone = true; break; } } - return hasSingle; + return hasSingleOrNone; } private Pair<Boolean, Set<String>> hasOverlap(ArrayList<Set<String>> dimsList, Set<String> Dims) {
