This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch kylin-on-parquet-v2 in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/kylin-on-parquet-v2 by this push: new f1436a3 KYLIN-5027 Fix query result when the cube does not build baseCuboid f1436a3 is described below commit f1436a3ea2610a2f41b7b0b89f2db87dd9999909 Author: yaqian.zhang <598593...@qq.com> AuthorDate: Wed Jul 28 17:33:57 2021 +0800 KYLIN-5027 Fix query result when the cube does not build baseCuboid --- .../org/apache/kylin/cube/CubeCapabilityChecker.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java index 4108ba9..5ba0a2d 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java @@ -23,9 +23,12 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.Arrays; +import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.apache.kylin.cube.model.AggregationGroup; import org.apache.kylin.cube.model.CubeDesc; import org.apache.kylin.measure.MeasureType; import org.apache.kylin.measure.basic.BasicMeasureType; @@ -175,7 +178,18 @@ public class CubeCapabilityChecker { private static Set<TblColRef> unmatchedDimensions(Collection<TblColRef> dimensionColumns, CubeInstance cube) { HashSet<TblColRef> result = Sets.newHashSet(dimensionColumns); CubeDesc cubeDesc = cube.getDescriptor(); - result.removeAll(cubeDesc.listDimensionColumnsIncludingDerived()); + if (cube.getConfig().isBuildBaseCuboid()) { + result.removeAll(cubeDesc.listDimensionColumnsIncludingDerived()); + } else { + HashSet<TblColRef> aggResult = result; + for (AggregationGroup aggGroup : cubeDesc.getAggregationGroups()) { + HashSet<TblColRef> tmpAggResult = (HashSet<TblColRef>) result.stream().filter(col -> !Arrays.asList(aggGroup.getIncludes()).contains(col.getCanonicalName())).collect(Collectors.toSet()); + if (tmpAggResult.size() < aggResult.size()) { + aggResult = tmpAggResult; + } + } + result = aggResult; + } return result; }