From 59647cbe0df4b3d651af1b5c63a9e14cf653e6e4 Mon Sep 17 00:00:00 2001 From: "peng.jianhua" Date: Wed, 22 Nov 2017 17:43:45 +0800 Subject: [PATCH 1/1] KYLIN-3053 When aggregation group verification failed, the error message about aggregation group number does not match with the actual on the Advanced Setting page --- .../main/java/org/apache/kylin/cube/model/CubeDesc.java | 4 ++-- .../cube/model/validation/rule/AggregationGroupRule.java | 2 +- .../org/apache/kylin/cube/AggregationGroupRuleTest.java | 6 +++--- .../test/java/org/apache/kylin/cube/CubeDescTest.java | 16 ++++++++-------- 4 files changed, 14 insertions(+), 14 deletions(-) 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 01dd30259..c9ef81cde 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 @@ -650,7 +650,7 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware { } public void validateAggregationGroupsCombination() { - int index = 0; + int index = 1; for (AggregationGroup agg : getAggregationGroups()) { try { @@ -675,7 +675,7 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware { } public void validateAggregationGroups() { - int index = 0; + int index = 1; for (AggregationGroup agg : getAggregationGroups()) { if (agg.getIncludes() == null) { diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/AggregationGroupRule.java b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/AggregationGroupRule.java index 33fc39042..2b0358d15 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/AggregationGroupRule.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/AggregationGroupRule.java @@ -55,7 +55,7 @@ public class AggregationGroupRule implements IValidatorRule { return; } - int index = 0; + int index = 1; for (AggregationGroup agg : cube.getAggregationGroups()) { if (agg.getIncludes() == null) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " 'includes' field not set"); diff --git a/core-cube/src/test/java/org/apache/kylin/cube/AggregationGroupRuleTest.java b/core-cube/src/test/java/org/apache/kylin/cube/AggregationGroupRuleTest.java index 1444ee121..eb553598d 100644 --- a/core-cube/src/test/java/org/apache/kylin/cube/AggregationGroupRuleTest.java +++ b/core-cube/src/test/java/org/apache/kylin/cube/AggregationGroupRuleTest.java @@ -87,7 +87,7 @@ public class AggregationGroupRuleTest extends LocalFileMetadataTestCase { rule.validate(desc, vContext); //vContext.print(System.out); assertTrue(vContext.getResults().length > 0); - assertTrue(vContext.getResults()[0].getMessage().startsWith("Aggregation group 0 has too many combinations")); + assertTrue(vContext.getResults()[0].getMessage().startsWith("Aggregation group 1 has too many combinations")); } } @@ -117,7 +117,7 @@ public class AggregationGroupRuleTest extends LocalFileMetadataTestCase { rule.validate(desc, vContext); //vContext.print(System.out); assertEquals(1, vContext.getResults().length); - assertEquals("Aggregation group 0 'includes' dimensions not include all the dimensions:[seller_id, META_CATEG_NAME, lstg_format_name, lstg_site_id, slr_segment_cd]", (vContext.getResults()[0].getMessage())); + assertEquals("Aggregation group 1 'includes' dimensions not include all the dimensions:[seller_id, META_CATEG_NAME, lstg_format_name, lstg_site_id, slr_segment_cd]", (vContext.getResults()[0].getMessage())); } @Test @@ -132,7 +132,7 @@ public class AggregationGroupRuleTest extends LocalFileMetadataTestCase { rule.validate(desc, vContext); //vContext.print(System.out); assertEquals(2, vContext.getResults().length); - assertEquals("Aggregation group 0 joint dimensions has overlap with more than 1 dimensions in same hierarchy: [CATEG_LVL2_NAME, META_CATEG_NAME]", (vContext.getResults()[0].getMessage())); + assertEquals("Aggregation group 1 joint dimensions has overlap with more than 1 dimensions in same hierarchy: [CATEG_LVL2_NAME, META_CATEG_NAME]", (vContext.getResults()[0].getMessage())); } @Test diff --git a/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java b/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java index ae7b17c47..9f0ae122f 100644 --- a/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java +++ b/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java @@ -196,7 +196,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { @Test public void testBadInit3() throws Exception { thrown.expect(IllegalStateException.class); - thrown.expectMessage("Aggregation group 0 'includes' dimensions not include all the dimensions:"); + thrown.expectMessage("Aggregation group 1 'includes' dimensions not include all the dimensions:"); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); String[] temp = Arrays.asList(cubeDesc.getAggregationGroups().get(0).getIncludes()).subList(0, 3) .toArray(new String[3]); @@ -209,7 +209,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { public void testBadInit4() throws Exception { thrown.expect(TooManyCuboidException.class); thrown.expectMessage( - "Aggregation group 0 of Cube Desc test_kylin_cube_with_slr_desc has too many combinations: 31. Use 'mandatory'/'hierarchy'/'joint' to optimize; or update 'kylin.cube.aggrgroup.max-combination' to a bigger value."); + "Aggregation group 1 of Cube Desc test_kylin_cube_with_slr_desc has too many combinations: 31. Use 'mandatory'/'hierarchy'/'joint' to optimize; or update 'kylin.cube.aggrgroup.max-combination' to a bigger value."); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); try { @@ -242,7 +242,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { @Test public void testBadInit7() throws Exception { thrown.expect(IllegalStateException.class); - thrown.expectMessage("Aggregation group 0 require at least 2 dimensions in a joint"); + thrown.expectMessage("Aggregation group 1 require at least 2 dimensions in a joint"); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().jointDims = new String[][] { @@ -256,7 +256,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { String[] strs = new String[] { CATEG_LVL2_NAME, META_CATEG_NAME }; thrown.expect(IllegalStateException.class); thrown.expectMessage( - "Aggregation group 0 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs)); + "Aggregation group 1 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs)); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().jointDims = new String[][] { @@ -270,7 +270,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { String[] strs = new String[] { LSTG_FORMAT_NAME, META_CATEG_NAME }; thrown.expect(IllegalStateException.class); thrown.expectMessage( - "Aggregation group 0 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs)); + "Aggregation group 1 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs)); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchyDims = new String[][] { new String[] { META_CATEG_NAME, CATEG_LVL2_NAME, CATEG_LVL3_NAME }, @@ -285,7 +285,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { public void testBadInit10() throws Exception { String[] strs = new String[] { LSTG_FORMAT_NAME, LSTG_SITE_ID }; thrown.expect(IllegalStateException.class); - thrown.expectMessage("Aggregation group 0 a dimension exist in more than one joint: " + sortStrs(strs)); + thrown.expectMessage("Aggregation group 1 a dimension exist in more than one joint: " + sortStrs(strs)); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().jointDims = new String[][] { @@ -298,7 +298,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { @Test public void testBadInit11() throws Exception { thrown.expect(IllegalStateException.class); - thrown.expectMessage("Aggregation group 0 require at least 2 dimensions in a hierarchy."); + thrown.expectMessage("Aggregation group 1 require at least 2 dimensions in a hierarchy."); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchyDims = new String[][] { @@ -311,7 +311,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase { public void testBadInit12() throws Exception { String[] strs = new String[] { CATEG_LVL2_NAME, META_CATEG_NAME }; thrown.expect(IllegalStateException.class); - thrown.expectMessage("Aggregation group 0 a dimension exist in more than one hierarchy: " + sortStrs(strs)); + thrown.expectMessage("Aggregation group 1 a dimension exist in more than one hierarchy: " + sortStrs(strs)); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchyDims = new String[][] { -- 2.11.0.windows.1