[Chore](function) remove unused check on count function (#31400)

This commit is contained in:
Pxl
2024-02-27 23:42:30 +08:00
committed by yiguolei
parent 7f566f9365
commit 3acfda413b
4 changed files with 14 additions and 29 deletions

View File

@ -843,12 +843,6 @@ public class FunctionCallExpr extends Expr {
throw new AnalysisException(
"COUNT must have DISTINCT for multiple arguments: " + this.toSql());
}
for (Expr child : children) {
if (child.type.isOnlyMetricType() && !child.type.isComplexType()) {
throw new AnalysisException(Type.OnlyMetricTypeErrorMsg);
}
}
return;
}

View File

@ -28,6 +28,7 @@ import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.rewrite.ExprRewriter;
import org.apache.doris.rewrite.mvrewrite.CountDistinctToBitmapOrHLLRule;
import org.apache.doris.thrift.TQueryOptions;
import com.google.common.base.Preconditions;
@ -275,12 +276,18 @@ public abstract class QueryStmt extends StatementBase implements Queriable {
}
protected Expr rewriteQueryExprByMvColumnExpr(Expr expr, Analyzer analyzer) throws AnalysisException {
if (analyzer == null || analyzer.getMVExprRewriter() == null || forbiddenMVRewrite) {
if (analyzer == null || analyzer.getMVExprRewriter() == null) {
return expr;
}
ExprRewriter rewriter = analyzer.getMVExprRewriter();
rewriter.reset();
rewriter.setInfoMVRewriter(disableTuplesMVRewriter, mvSMap, aliasSMap);
ExprRewriter rewriter;
if (forbiddenMVRewrite) {
rewriter = new ExprRewriter(Lists.newArrayList(CountDistinctToBitmapOrHLLRule.INSTANCE),
Lists.newArrayList());
} else {
rewriter = analyzer.getMVExprRewriter();
rewriter.reset();
rewriter.setInfoMVRewriter(disableTuplesMVRewriter, mvSMap, aliasSMap);
}
rewriter.setUpBottom();
Expr result = rewriter.rewrite(expr, analyzer);