diff --git a/core-storage/src/main/java/org/apache/kylin/storage/gtrecord/GTCubeStorageQueryBase.java b/core-storage/src/main/java/org/apache/kylin/storage/gtrecord/GTCubeStorageQueryBase.java index a6d30bb..a18278c 100644 --- a/core-storage/src/main/java/org/apache/kylin/storage/gtrecord/GTCubeStorageQueryBase.java +++ b/core-storage/src/main/java/org/apache/kylin/storage/gtrecord/GTCubeStorageQueryBase.java @@ -37,6 +37,7 @@ import org.apache.kylin.cube.model.CubeDesc.DeriveInfo; import org.apache.kylin.dict.lookup.LookupStringTable; import org.apache.kylin.gridtable.StorageLimitLevel; import org.apache.kylin.measure.MeasureType; +import org.apache.kylin.measure.bitmap.BitmapMeasureType; import org.apache.kylin.metadata.filter.CaseTupleFilter; import org.apache.kylin.metadata.filter.ColumnTupleFilter; import org.apache.kylin.metadata.filter.CompareTupleFilter; @@ -141,7 +142,7 @@ public abstract class GTCubeStorageQueryBase implements IStorageQuery { // exactAggregation mean: needn't aggregation at storage and query engine both. boolean exactAggregation = isExactAggregation(context, cuboid, groups, otherDimsD, singleValuesD, - derivedPostAggregation, sqlDigest.aggregations); + derivedPostAggregation, sqlDigest.aggregations, sqlDigest.aggrSqlCalls); context.setExactAggregation(exactAggregation); // replace derived columns in filter with host columns; columns on loosened condition must be added to group by @@ -498,7 +499,7 @@ public abstract class GTCubeStorageQueryBase implements IStorageQuery { private boolean isExactAggregation(StorageContext context, Cuboid cuboid, Collection groups, Set othersD, Set singleValuesD, Set derivedPostAggregation, - Collection functionDescs) { + Collection functionDescs, List aggrSQLCalls) { if (context.isNeedStorageAggregation()) { logger.info("exactAggregation is false because need storage aggregation"); return false; @@ -530,6 +531,12 @@ public abstract class GTCubeStorageQueryBase implements IStorageQuery { return false; } } + for (SQLDigest.SQLCall aggrSQLCall : aggrSQLCalls) { + if (aggrSQLCall.function.equals(BitmapMeasureType.FUNC_INTERSECT_COUNT_DISTINCT)) { + logger.info("exactAggregation is false because has INTERSECT_COUNT"); + return false; + } + } // for partitioned cube, the partition column must belong to group by or has single value PartitionDesc partDesc = cuboid.getCubeDesc().getModel().getPartitionDesc();