You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2016/11/20 01:38:10 UTC
kylin git commit: KYLIN-2178 fix the UT with jdk1.8 [Forced Update!]
Repository: kylin
Updated Branches:
refs/heads/v1.6.0-rc2 dcb0bc333 -> 50933a6c8 (forced update)
KYLIN-2178 fix the UT with jdk1.8
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/50933a6c
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/50933a6c
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/50933a6c
Branch: refs/heads/v1.6.0-rc2
Commit: 50933a6c80e447033c304746eecd88e6516142fc
Parents: 79909ba
Author: shaofengshi <sh...@apache.org>
Authored: Sat Nov 19 17:20:01 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Sun Nov 20 09:37:57 2016 +0800
----------------------------------------------------------------------
.../org/apache/kylin/cube/model/CubeDesc.java | 9 +++----
.../validation/rule/AggregationGroupRule.java | 11 +++++----
.../kylin/cube/AggregationGroupRuleTest.java | 25 ++++++++++----------
.../org/apache/kylin/cube/CubeDescTest.java | 1 +
.../ut_cube_desc_combination_int_overflow.json | 4 ++--
5 files changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/50933a6c/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 4a5747b..77e6179 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
@@ -616,15 +616,16 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware {
}
if (CollectionUtils.containsAny(mandatoryDims, hierarchyDims)) {
- logger.warn("Aggregation group " + index + " mandatory dimensions overlap with hierarchy dimensions: " + CollectionUtils.intersection(mandatoryDims, hierarchyDims));
+
+ logger.warn("Aggregation group " + index + " mandatory dimensions overlap with hierarchy dimensions: " + Sets.intersection(mandatoryDims, hierarchyDims));
}
if (CollectionUtils.containsAny(mandatoryDims, jointDims)) {
- logger.warn("Aggregation group " + index + " mandatory dimensions overlap with joint dimensions: " + CollectionUtils.intersection(mandatoryDims, jointDims));
+ logger.warn("Aggregation group " + index + " mandatory dimensions overlap with joint dimensions: " + Sets.intersection(mandatoryDims, jointDims));
}
if (CollectionUtils.containsAny(hierarchyDims, jointDims)) {
logger.error("Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions");
- throw new IllegalStateException("Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions: " + CollectionUtils.intersection(hierarchyDims, jointDims));
+ throw new IllegalStateException("Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions: " + Sets.intersection(hierarchyDims, jointDims));
}
if (hasSingle(hierarchyDimsList)) {
@@ -689,7 +690,7 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware {
Set<String> overlap = new TreeSet<>();
for (Set<String> dims : dimsList) {
if (CollectionUtils.containsAny(existing, dims)) {
- overlap.addAll(CollectionUtils.intersection(existing, dims));
+ overlap.addAll(Sets.intersection(existing, dims));
}
existing.addAll(dims);
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/50933a6c/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/AggregationGroupRule.java
----------------------------------------------------------------------
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 341efe7..55cb844 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
@@ -18,12 +18,12 @@
package org.apache.kylin.cube.model.validation.rule;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.kylin.cube.model.AggregationGroup;
import org.apache.kylin.cube.model.CubeDesc;
@@ -148,8 +148,11 @@ public class AggregationGroupRule implements IValidatorRule<CubeDesc> {
int overlapHierarchies = 0;
if (agg.getSelectRule().hierarchy_dims != null) {
for (String[] oneHierarchy : agg.getSelectRule().hierarchy_dims) {
- Set<String> share = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
- share.addAll(CollectionUtils.intersection(oneJoint, Arrays.asList(oneHierarchy)));
+ Set<String> oneHierarchySet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
+ for (String s : oneHierarchy) {
+ oneHierarchySet.add(s);
+ }
+ Set<String> share = Sets.intersection(oneJoint, oneHierarchySet);
if (!share.isEmpty()) {
overlapHierarchies++;
@@ -177,7 +180,7 @@ public class AggregationGroupRule implements IValidatorRule<CubeDesc> {
oneJoint.add(s);
}
if (CollectionUtils.containsAny(existing, oneJoint)) {
- overlap.addAll(CollectionUtils.intersection(existing, oneJoint));
+ overlap.addAll(Sets.intersection(existing, oneJoint));
}
existing.addAll(oneJoint);
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/50933a6c/core-cube/src/test/java/org/apache/kylin/cube/AggregationGroupRuleTest.java
----------------------------------------------------------------------
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 563e139..4f42693 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
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
@@ -112,20 +112,21 @@ public class AggregationGroupRuleTest {
IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
rule.validate(desc, vContext);
vContext.print(System.out);
- assertEquals(1, 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()));
}
- @Test
- public void testCombinationIntOverflow() throws IOException {
- ValidateContext vContext = new ValidateContext();
- CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/ut_cube_desc_combination_int_overflow.json"), CubeDesc.class);
-
- IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
- rule.validate(desc, vContext);
- assertEquals(1, vContext.getResults().length);
- }
-
+ @Test
+ public void testCombinationIntOverflow() throws IOException {
+ ValidateContext vContext = new ValidateContext();
+ CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/ut_cube_desc_combination_int_overflow.json"), CubeDesc.class);
+
+ desc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { };
+
+ IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
+ rule.validate(desc, vContext);
+ assertEquals(1, vContext.getResults().length);
+ }
+
public AggregationGroupRule getAggregationGroupRule() {
AggregationGroupRule rule = new AggregationGroupRule() {
@Override
http://git-wip-us.apache.org/repos/asf/kylin/blob/50933a6c/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java
----------------------------------------------------------------------
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 ca7ae50..01e5090 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,6 +196,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
public void testCombinationIntOverflow() throws Exception {
thrown.expect(IllegalStateException.class);
CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("ut_cube_desc_combination_int_overflow");
+ cubeDesc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { };
cubeDesc.init(getTestConfig());
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/50933a6c/examples/test_case_data/localmeta/cube_desc/ut_cube_desc_combination_int_overflow.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/cube_desc/ut_cube_desc_combination_int_overflow.json b/examples/test_case_data/localmeta/cube_desc/ut_cube_desc_combination_int_overflow.json
index ec6f8f4..e8e2a52 100644
--- a/examples/test_case_data/localmeta/cube_desc/ut_cube_desc_combination_int_overflow.json
+++ b/examples/test_case_data/localmeta/cube_desc/ut_cube_desc_combination_int_overflow.json
@@ -376,8 +376,8 @@
"includes" : [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH"],
"select_rule" : {
"hierarchy_dims" : [ ],
- "mandatory_dims" : [ ],
- "joint_dims" : [ ]
+ "mandatory_dims" : [ "A" ],
+ "joint_dims" : [ ["L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH"] ]
}
}],
"signature" : "4NqJVcVIYRF5PkJ0jS+9Rg==",