[fix](agg)disallow group by bitmap or hll data type (#11782)

* [fix](agg)disallow group by bitmap or hll data type
This commit is contained in:
starocean999
2022-08-16 09:25:02 +08:00
committed by GitHub
parent d37cf0a41b
commit f3f1bbc48c
2 changed files with 49 additions and 0 deletions

View File

@ -21,6 +21,7 @@
package org.apache.doris.analysis;
import org.apache.doris.catalog.FunctionSet;
import org.apache.doris.catalog.Type;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.util.VectorizedUtil;
import org.apache.doris.planner.DataPartition;
@ -160,6 +161,14 @@ public final class AggregateInfo extends AggregateInfoBase {
partitionExprs = exprs;
}
private static void validateGroupingExprs(List<Expr> groupingExprs) throws AnalysisException {
for (Expr expr : groupingExprs) {
if (expr.getType().isOnlyMetricType()) {
throw new AnalysisException(Type.OnlyMetricTypeErrorMsg);
}
}
}
/**
* Creates complete AggregateInfo for groupingExprs and aggExprs, including
* aggTupleDesc and aggTupleSMap. If parameter tupleDesc != null, sets aggTupleDesc to
@ -176,6 +185,7 @@ public final class AggregateInfo extends AggregateInfoBase {
Preconditions.checkState(
(groupingExprs != null && !groupingExprs.isEmpty())
|| (aggExprs != null && !aggExprs.isEmpty()));
validateGroupingExprs(groupingExprs);
AggregateInfo result = new AggregateInfo(groupingExprs, aggExprs, AggPhase.FIRST);
// collect agg exprs with DISTINCT clause