This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 299bb6707734dd2164392b594a5ff47dcfa6b65c
Author: Pengfei Zhan <dethr...@gmail.com>
AuthorDate: Fri Dec 30 17:53:49 2022 +0800

    KYLIN-5458 max dimension combination doesn't work
---
 .../exception/OutOfMaxCombinationException.java    |  9 ++--
 .../common/exception/code/ErrorCodeServer.java     |  1 +
 .../resources/kylin_error_msg_conf_cn.properties   |  1 +
 .../resources/kylin_error_msg_conf_en.properties   |  1 +
 .../main/resources/kylin_errorcode_conf.properties |  1 +
 .../metadata/cube/cuboid/CuboidScheduler.java      |  6 ++-
 .../metadata/cube/cuboid/KECuboidSchedulerV1.java  | 24 ++++-----
 .../metadata/cube/cuboid/KECuboidSchedulerV2.java  | 21 ++++----
 .../cube/model/RuleBasedCuboidDescTest.java        | 56 ++++++++++++++++++++-
 .../rest/request/UpdateRuleBasedCuboidRequest.java |  2 +-
 .../kylin/rest/service/IndexPlanServiceTest.java   | 58 +++++++++++-----------
 11 files changed, 121 insertions(+), 59 deletions(-)

diff --git 
a/src/core-common/src/main/java/org/apache/kylin/common/exception/OutOfMaxCombinationException.java
 
b/src/core-common/src/main/java/org/apache/kylin/common/exception/OutOfMaxCombinationException.java
index 61f6877660..9a389f3c0d 100644
--- 
a/src/core-common/src/main/java/org/apache/kylin/common/exception/OutOfMaxCombinationException.java
+++ 
b/src/core-common/src/main/java/org/apache/kylin/common/exception/OutOfMaxCombinationException.java
@@ -17,10 +17,11 @@
  */
 package org.apache.kylin.common.exception;
 
-public class OutOfMaxCombinationException extends RuntimeException {
+import org.apache.kylin.common.exception.code.ErrorCodeProducer;
 
-    public OutOfMaxCombinationException(String message) {
-        super(message);
-    }
+public class OutOfMaxCombinationException extends KylinException {
 
+    public OutOfMaxCombinationException(ErrorCodeProducer errorCodeProducer, 
Object... args) {
+        super(errorCodeProducer, args);
+    }
 }
diff --git 
a/src/core-common/src/main/java/org/apache/kylin/common/exception/code/ErrorCodeServer.java
 
b/src/core-common/src/main/java/org/apache/kylin/common/exception/code/ErrorCodeServer.java
index a51a2f54ef..67cf57afed 100644
--- 
a/src/core-common/src/main/java/org/apache/kylin/common/exception/code/ErrorCodeServer.java
+++ 
b/src/core-common/src/main/java/org/apache/kylin/common/exception/code/ErrorCodeServer.java
@@ -108,6 +108,7 @@ public enum ErrorCodeServer implements ErrorCodeProducer {
     INDEX_DUPLICATE("KE-010012202"),
     INDEX_PARAMETER_INVALID("KE-010012203"),
     SHARD_BY_COLUMN_NOT_IN_INDEX("KE-010012204"),
+    OUT_OF_MAX_DIM_COMBINATION("KE-010012205"),
 
     // 10043XX parameter check
     REQUEST_PARAMETER_EMPTY_OR_VALUE_EMPTY("KE-010043201"),
diff --git 
a/src/core-common/src/main/resources/kylin_error_msg_conf_cn.properties 
b/src/core-common/src/main/resources/kylin_error_msg_conf_cn.properties
index 7697a01c8f..77070d8924 100644
--- a/src/core-common/src/main/resources/kylin_error_msg_conf_cn.properties
+++ b/src/core-common/src/main/resources/kylin_error_msg_conf_cn.properties
@@ -110,6 +110,7 @@ KE-010012201=索引元数据不一致。请尝试刷新下列模型的所有 Seg
 KE-010012202=因为存在相同的索引,无法新建该索引。请修改。
 KE-010012203=参数 “%s” 仅支持 “%s”。
 KE-010012204=ShardBy 列不在索引包含的列中,请修改后重试。
+KE-010012205=聚合组生成的索引数超出系统允许的最大索引数(%s)。
 
 ## 10043XX parameter check
 KE-010043201=请求参数 “%s” 为空或值为空。请检查请求参数是否正确填写。
diff --git 
a/src/core-common/src/main/resources/kylin_error_msg_conf_en.properties 
b/src/core-common/src/main/resources/kylin_error_msg_conf_en.properties
index 6acc8373fc..7c67ccdae4 100644
--- a/src/core-common/src/main/resources/kylin_error_msg_conf_en.properties
+++ b/src/core-common/src/main/resources/kylin_error_msg_conf_en.properties
@@ -108,6 +108,7 @@ KE-010012201=Index metadata might be inconsistent. Please 
try refreshing all seg
 KE-010012202=Can't add this index, as the same index already exists. Please 
modify.
 KE-010012203=The parameter "%s" only supports "%s".
 KE-010012204=The ShardBy column is not included in the index. Please fix and 
try again.
+KE-010012205=The number of indexes generated by the aggregate group exceeds 
the maximum number(%s) of indexes allowed by the system.
 
 ## 10043XX parameter check
 KE-010043201=Request parameter "%s" is empty or value is empty. Please check 
the request parameters.
diff --git a/src/core-common/src/main/resources/kylin_errorcode_conf.properties 
b/src/core-common/src/main/resources/kylin_errorcode_conf.properties
index 8fb380af3f..091be9bf2b 100644
--- a/src/core-common/src/main/resources/kylin_errorcode_conf.properties
+++ b/src/core-common/src/main/resources/kylin_errorcode_conf.properties
@@ -120,6 +120,7 @@ KE-010012201
 KE-010012202
 KE-010012203
 KE-010012204
+KE-010012205
 
 ## 10043XX parameter check
 KE-010043201
diff --git 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/CuboidScheduler.java
 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/CuboidScheduler.java
index 75fbce510c..6da2b6469f 100644
--- 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/CuboidScheduler.java
+++ 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/CuboidScheduler.java
@@ -39,8 +39,6 @@ import lombok.val;
  */
 public abstract class CuboidScheduler implements Serializable {
 
-    protected static final String OUT_OF_MAX_COMBINATION_MSG_FORMAT = "Too 
many cuboids for the cube. Cuboid combination reached %s and limit is %s. Abort 
calculation.";
-
     public static CuboidScheduler getInstance(IndexPlan indexPlan, 
RuleBasedIndex ruleBasedIndex, boolean skipAll) {
         if (ruleBasedIndex.getSchedulerVersion() == 1) {
             return new KECuboidSchedulerV1(indexPlan, ruleBasedIndex, skipAll);
@@ -89,6 +87,10 @@ public abstract class CuboidScheduler implements 
Serializable {
         return indexPlan;
     }
 
+    public long getAggGroupCombinationSize() {
+        return indexPlan.getConfig().getCubeAggrGroupMaxCombination();
+    }
+
     protected ColOrder extractDimAndMeaFromBigInt(BigInteger bigInteger) {
         val allDims = ruleBasedAggIndex.getDimensions();
         val allMeas = ruleBasedAggIndex.getMeasures();
diff --git 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV1.java
 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV1.java
index 82cc18bf78..325898a158 100644
--- 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV1.java
+++ 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV1.java
@@ -24,7 +24,6 @@ import java.math.BigInteger;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
@@ -34,8 +33,8 @@ import java.util.stream.Stream;
 import javax.annotation.Nullable;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.exception.OutOfMaxCombinationException;
+import org.apache.kylin.common.exception.code.ErrorCodeServer;
 import org.apache.kylin.common.util.ThreadUtil;
 import org.apache.kylin.metadata.cube.model.IndexPlan;
 import org.apache.kylin.metadata.cube.model.RuleBasedIndex;
@@ -163,19 +162,16 @@ public class KECuboidSchedulerV1 extends CuboidScheduler {
      * @return Cuboid collection
      */
     private Set<CuboidBigInteger> buildTreeBottomUp(SetCreator setCreatorFunc) 
{
-        KylinConfig config = indexPlan.getConfig();
-        long maxCombination = config.getCubeAggrGroupMaxCombination() * 10;
-        maxCombination = maxCombination < 0 ? Long.MAX_VALUE : maxCombination;
-
         Set<CuboidBigInteger> cuboidHolder = setCreatorFunc.create();
 
         // build tree structure
+        long maxCombination = getAggGroupCombinationSize() * 10;
+        maxCombination = maxCombination < 0 ? Integer.MAX_VALUE : 
maxCombination;
         Set<CuboidBigInteger> children = 
getOnTreeParentsByLayer(Sets.newHashSet(new CuboidBigInteger(BigInteger.ZERO)),
                 setCreatorFunc, maxCombination); // lowest level cuboids
         while (!children.isEmpty()) {
             if (cuboidHolder.size() + children.size() > maxCombination) {
-                throw new 
OutOfMaxCombinationException(String.format(Locale.ROOT, 
OUT_OF_MAX_COMBINATION_MSG_FORMAT,
-                        cuboidHolder.size() + children.size(), 
maxCombination));
+                throw new 
OutOfMaxCombinationException(ErrorCodeServer.OUT_OF_MAX_DIM_COMBINATION, 
maxCombination);
             }
             cuboidHolder.addAll(children);
             children = getOnTreeParentsByLayer(children, setCreatorFunc, 
maxCombination);
@@ -210,19 +206,20 @@ public class KECuboidSchedulerV1 extends CuboidScheduler {
                 if (cuboidId == null) {
                     return false;
                 }
-                if (++cuboidCount > maxCombination) {
-                    throw new OutOfMaxCombinationException(
-                            String.format(Locale.ROOT, 
OUT_OF_MAX_COMBINATION_MSG_FORMAT, cuboidCount, maxCombination));
+                if (cuboidCount > maxCombination) {
+                    throw new 
OutOfMaxCombinationException(ErrorCodeServer.OUT_OF_MAX_DIM_COMBINATION, 
maxCombination);
                 }
 
                 BigInteger cuboidBits = cuboidId.getDimMeas();
 
                 if (cuboidBits.equals(ruleBasedAggIndex.getFullMask()) && 
isBaseCuboidValid) {
+                    cuboidCount++;
                     return true;
                 }
 
                 for (NAggregationGroup agg : 
ruleBasedAggIndex.getAggregationGroups()) {
                     if (agg.isOnTree(cuboidBits) && 
agg.checkDimCap(cuboidBits)) {
+                        cuboidCount++;
                         return true;
                     }
                 }
@@ -253,8 +250,9 @@ public class KECuboidSchedulerV1 extends CuboidScheduler {
         Set<CuboidBigInteger> children = 
getOnTreeParentsByLayer(Sets.newHashSet(new CuboidBigInteger(BigInteger.ZERO)),
                 agg, newHashSet); // lowest level cuboids
         while (!children.isEmpty()) {
-            if (cuboidHolder.size() + children.size() > 
indexPlan.getConfig().getCubeAggrGroupMaxCombination()) {
-                throw new OutOfMaxCombinationException("Holder size larger 
than kylin.cube.aggrgroup.max-combination");
+            if (cuboidHolder.size() + children.size() > 
getAggGroupCombinationSize()) {
+                throw new 
OutOfMaxCombinationException(ErrorCodeServer.OUT_OF_MAX_DIM_COMBINATION,
+                        getAggGroupCombinationSize());
             }
             cuboidHolder.addAll(children);
             children = getOnTreeParentsByLayer(children, agg, newHashSet);
diff --git 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV2.java
 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV2.java
index b1705c0525..eff3825eb7 100644
--- 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV2.java
+++ 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/cube/cuboid/KECuboidSchedulerV2.java
@@ -22,12 +22,12 @@ import java.math.BigInteger;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
-import java.util.Locale;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.kylin.common.exception.OutOfMaxCombinationException;
+import org.apache.kylin.common.exception.code.ErrorCodeServer;
 import org.apache.kylin.metadata.cube.model.IndexPlan;
 import org.apache.kylin.metadata.cube.model.RuleBasedIndex;
 
@@ -40,14 +40,13 @@ import lombok.extern.slf4j.Slf4j;
 @Slf4j
 public class KECuboidSchedulerV2 extends CuboidScheduler {
 
-    private final BigInteger max;
     private final int measureSize;
     private transient final OrderedSet<ColOrder> allColOrders;
 
     KECuboidSchedulerV2(IndexPlan indexPlan, RuleBasedIndex ruleBasedAggIndex, 
boolean skipAll) {
         super(indexPlan, ruleBasedAggIndex);
 
-        this.max = ruleBasedAggIndex.getFullMask();
+        BigInteger max = ruleBasedAggIndex.getFullMask();
         this.measureSize = ruleBasedAggIndex.getMeasures().size();
 
         // handle nRuleBasedCuboidDesc has 0 dimensions
@@ -55,19 +54,20 @@ public class KECuboidSchedulerV2 extends CuboidScheduler {
         if (max.bitCount() == 0 || skipAll) {
             return;
         }
-        long maxCombination = 
indexPlan.getConfig().getCubeAggrGroupMaxCombination() * 10;
-        maxCombination = maxCombination < 0 ? Long.MAX_VALUE : maxCombination;
+
         if (ruleBasedAggIndex.getBaseLayoutEnabled() == null) {
             ruleBasedAggIndex.setBaseLayoutEnabled(true);
         }
         if (Boolean.TRUE.equals(ruleBasedAggIndex.getBaseLayoutEnabled())) {
             allColOrders.add(new ColOrder(ruleBasedAggIndex.getDimensions(), 
ruleBasedAggIndex.getMeasures()));
         }
+
+        long maxCombinationSize = getAggGroupCombinationSize() * 10;
+        maxCombinationSize = maxCombinationSize < 0 ? Integer.MAX_VALUE : 
maxCombinationSize;
         for (NAggregationGroup agg : ruleBasedAggIndex.getAggregationGroups()) 
{
             allColOrders.addAll(calculateCuboidsForAggGroup(agg));
-            if (allColOrders.size() > maxCombination) {
-                throw new 
OutOfMaxCombinationException(String.format(Locale.ROOT, 
OUT_OF_MAX_COMBINATION_MSG_FORMAT,
-                        allColOrders.size(), maxCombination));
+            if (allColOrders.size() > maxCombinationSize) {
+                throw new 
OutOfMaxCombinationException(ErrorCodeServer.OUT_OF_MAX_DIM_COMBINATION, 
maxCombinationSize);
             }
         }
     }
@@ -106,8 +106,9 @@ public class KECuboidSchedulerV2 extends CuboidScheduler {
         Set<CuboidBigInteger> children = 
getOnTreeParentsByLayer(Sets.newHashSet(new CuboidBigInteger(BigInteger.ZERO)),
                 agg); // lowest level cuboids
         while (!children.isEmpty()) {
-            if (cuboidHolder.size() + children.size() > 
indexPlan.getConfig().getCubeAggrGroupMaxCombination()) {
-                throw new OutOfMaxCombinationException("Holder size larger 
than kylin.cube.aggrgroup.max-combination");
+            if (cuboidHolder.size() + children.size() > 
getAggGroupCombinationSize()) {
+                throw new 
OutOfMaxCombinationException(ErrorCodeServer.OUT_OF_MAX_DIM_COMBINATION,
+                        getAggGroupCombinationSize());
             }
             cuboidHolder.addAll(children);
             children = getOnTreeParentsByLayer(children, agg);
diff --git 
a/src/core-metadata/src/test/java/org/apache/kylin/metadata/cube/model/RuleBasedCuboidDescTest.java
 
b/src/core-metadata/src/test/java/org/apache/kylin/metadata/cube/model/RuleBasedCuboidDescTest.java
index 404258a670..0e9c9890cc 100644
--- 
a/src/core-metadata/src/test/java/org/apache/kylin/metadata/cube/model/RuleBasedCuboidDescTest.java
+++ 
b/src/core-metadata/src/test/java/org/apache/kylin/metadata/cube/model/RuleBasedCuboidDescTest.java
@@ -166,16 +166,70 @@ public class RuleBasedCuboidDescTest extends 
NLocalFileMetadataTestCase {
 
         CubeTestUtils.createTmpModel(getTestConfig(), newPlan);
 
+        try {
+            indexPlanManager.createIndexPlan(newPlan);
+            Assert.fail();
+        } catch (IllegalArgumentException e) {
+            Assert.assertEquals("The number of indexes generated by the 
aggregate group exceeds the maximum "
+                    + "number(40960) of indexes allowed by the system.", 
e.getMessage());
+        }
+    }
+
+    @Test
+    public void testGenTooManyCuboidsWithMaxDimCompIsOne() throws IOException {
+        val indexPlanManager = NIndexPlanManager.getInstance(getTestConfig(), 
"default");
+        var newPlan = 
JsonUtil.readValue(getClass().getResourceAsStream("/enormous_rule_based_cube.json"),
+                IndexPlan.class);
+        newPlan.setLastModified(0L);
+        List<NAggregationGroup> aggregationGroups = 
newPlan.getRuleBasedIndex().getAggregationGroups();
+        Assert.assertEquals(1, aggregationGroups.size());
+        aggregationGroups.get(0).getSelectRule().setDimCap(1);
+
+        CubeTestUtils.createTmpModel(getTestConfig(), newPlan);
+
+        IndexPlan indexPlan = indexPlanManager.createIndexPlan(newPlan);
+        List<LayoutEntity> allLayouts = indexPlan.getAllLayouts();
+        Assert.assertEquals(34, allLayouts.size());
+    }
+
+    @Test
+    public void testGenTooManyCuboidsWithScheduleVersion2() throws IOException 
{
+        val indexPlanManager = NIndexPlanManager.getInstance(getTestConfig(), 
"default");
+        var newPlan = 
JsonUtil.readValue(getClass().getResourceAsStream("/enormous_rule_based_cube.json"),
+                IndexPlan.class);
+        newPlan.setLastModified(0L);
+        newPlan.getRuleBasedIndex().setSchedulerVersion(2);
+
+        CubeTestUtils.createTmpModel(getTestConfig(), newPlan);
+
         try {
             indexPlanManager.createIndexPlan(newPlan);
             Assert.fail();
         } catch (IllegalArgumentException e) {
             Assert.assertEquals(
-                    "Too many cuboids for the cube. Cuboid combination reached 
41449 and limit is 40960. Abort calculation.",
+                    "The number of indexes generated by the aggregate group 
exceeds the maximum number(4096) of indexes allowed by the system.",
                     e.getMessage());
         }
     }
 
+    @Test
+    public void testGenTooManyCuboidsWithScheduleV2AndMaxDimCompIsOne() throws 
IOException {
+        val indexPlanManager = NIndexPlanManager.getInstance(getTestConfig(), 
"default");
+        var newPlan = 
JsonUtil.readValue(getClass().getResourceAsStream("/enormous_rule_based_cube.json"),
+                IndexPlan.class);
+        newPlan.setLastModified(0L);
+        newPlan.getRuleBasedIndex().setSchedulerVersion(2);
+        List<NAggregationGroup> aggregationGroups = 
newPlan.getRuleBasedIndex().getAggregationGroups();
+        Assert.assertEquals(1, aggregationGroups.size());
+        aggregationGroups.get(0).getSelectRule().setDimCap(1);
+
+        CubeTestUtils.createTmpModel(getTestConfig(), newPlan);
+
+        IndexPlan indexPlan = indexPlanManager.createIndexPlan(newPlan);
+        List<LayoutEntity> allLayouts = indexPlan.getAllLayouts();
+        Assert.assertEquals(34, allLayouts.size());
+    }
+
     @Test
     public void testGenCuboidsWithAuto() throws Exception {
         val indexPlanManager = NIndexPlanManager.getInstance(getTestConfig(), 
"default");
diff --git 
a/src/modeling-service/src/main/java/org/apache/kylin/rest/request/UpdateRuleBasedCuboidRequest.java
 
b/src/modeling-service/src/main/java/org/apache/kylin/rest/request/UpdateRuleBasedCuboidRequest.java
index c262ee221a..c919a1f735 100644
--- 
a/src/modeling-service/src/main/java/org/apache/kylin/rest/request/UpdateRuleBasedCuboidRequest.java
+++ 
b/src/modeling-service/src/main/java/org/apache/kylin/rest/request/UpdateRuleBasedCuboidRequest.java
@@ -51,7 +51,7 @@ public class UpdateRuleBasedCuboidRequest implements 
ProjectInsensitiveRequest {
 
     @Builder.Default
     @JsonProperty("scheduler_version")
-    private int schedulerVersion = 1;
+    private int schedulerVersion = 2;
 
     @Builder.Default
     @JsonProperty("load_data")
diff --git 
a/src/modeling-service/src/test/java/org/apache/kylin/rest/service/IndexPlanServiceTest.java
 
b/src/modeling-service/src/test/java/org/apache/kylin/rest/service/IndexPlanServiceTest.java
index 72d5df1edf..2a8db33ac3 100644
--- 
a/src/modeling-service/src/test/java/org/apache/kylin/rest/service/IndexPlanServiceTest.java
+++ 
b/src/modeling-service/src/test/java/org/apache/kylin/rest/service/IndexPlanServiceTest.java
@@ -17,19 +17,33 @@
  */
 package org.apache.kylin.rest.service;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.kylin.engine.spark.job.ExecutableAddCuboidHandler;
-import org.apache.kylin.engine.spark.job.NSparkCubingJob;
-import lombok.extern.slf4j.Slf4j;
-import lombok.val;
-import lombok.var;
+import static 
org.apache.kylin.common.exception.code.ErrorCodeServer.INDEX_DUPLICATE;
+import static 
org.apache.kylin.common.exception.code.ErrorCodeServer.LAYOUT_NOT_EXISTS;
+import static 
org.apache.kylin.metadata.cube.model.IndexEntity.Source.CUSTOM_TABLE_INDEX;
+import static 
org.apache.kylin.metadata.cube.model.IndexEntity.Source.RECOMMENDED_TABLE_INDEX;
+import static org.apache.kylin.metadata.model.SegmentStatusEnum.READY;
+import static org.apache.kylin.metadata.model.SegmentStatusEnum.WARNING;
+import static org.hamcrest.Matchers.is;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
 import org.apache.commons.collections.ListUtils;
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.exception.KylinException;
 import org.apache.kylin.common.msg.Message;
 import org.apache.kylin.common.util.JsonUtil;
 import org.apache.kylin.cube.model.SelectRule;
+import org.apache.kylin.engine.spark.job.ExecutableAddCuboidHandler;
+import org.apache.kylin.engine.spark.job.NSparkCubingJob;
 import org.apache.kylin.metadata.cube.cuboid.NAggregationGroup;
 import org.apache.kylin.metadata.cube.model.IndexEntity;
 import org.apache.kylin.metadata.cube.model.IndexPlan;
@@ -69,24 +83,12 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.springframework.test.util.ReflectionTestUtils;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
-import static 
org.apache.kylin.common.exception.code.ErrorCodeServer.INDEX_DUPLICATE;
-import static 
org.apache.kylin.common.exception.code.ErrorCodeServer.LAYOUT_NOT_EXISTS;
-import static 
org.apache.kylin.metadata.cube.model.IndexEntity.Source.CUSTOM_TABLE_INDEX;
-import static 
org.apache.kylin.metadata.cube.model.IndexEntity.Source.RECOMMENDED_TABLE_INDEX;
-import static org.apache.kylin.metadata.model.SegmentStatusEnum.READY;
-import static org.apache.kylin.metadata.model.SegmentStatusEnum.WARNING;
-import static org.hamcrest.Matchers.is;
+import lombok.val;
+import lombok.var;
+import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class IndexPlanServiceTest extends SourceTestCase {
@@ -1258,8 +1260,8 @@ public class IndexPlanServiceTest extends SourceTestCase {
                 indexPlanService.getIndexGraph(getProject(), modelId, 
100).getSegmentToComplementCount());
 
         // mark a layout tobedelete
-        indexManager.updateIndexPlan(modelId,
-                copyForWrite -> copyForWrite.markWhiteIndexToBeDelete(modelId, 
Sets.newHashSet(tobeDeleteLayoutId), Collections.emptyMap()));
+        indexManager.updateIndexPlan(modelId, copyForWrite -> 
copyForWrite.markWhiteIndexToBeDelete(modelId,
+                Sets.newHashSet(tobeDeleteLayoutId), Collections.emptyMap()));
 
         //remove tobedelete layout from seg1
         val newDf = dfManager.getDataflow(modelId);
@@ -1323,12 +1325,12 @@ public class IndexPlanServiceTest extends 
SourceTestCase {
     }
 
     @Test
-    public void testCalculateAggIndexCountWhenTotalCuboidsOutOfMaxComb() 
throws Exception {
+    public void testCalculateAggIndexCountWhenTotalCuboidsOutOfMaxComb() {
         testOutOfCombination(1);
     }
 
     @Test
-    public void 
testCalculateAggIndexCountWhenTotalCuboidsOutOfMaxComb_WithSchedulerV2() throws 
Exception {
+    public void 
testCalculateAggIndexCountWhenTotalCuboidsOutOfMaxComb_WithSchedulerV2() {
         testOutOfCombination(2);
     }
 

Reply via email to