[Bug](materialized-view) fix some bugs on create mv with percentile_approx (#26528)

1. percentile_approx have wrong symbol
2. fnCall.getParams() get obsolete childrens
This commit is contained in:
Pxl
2023-11-08 10:09:37 +08:00
committed by GitHub
parent 519b48648e
commit 3cdbb6e637
8 changed files with 80 additions and 14 deletions

View File

@ -518,6 +518,10 @@ public class CreateMaterializedViewStmt extends DdlStmt {
break;
default:
mvAggregateType = AggregateType.GENERIC_AGGREGATION;
if (functionCallExpr.getParams().isDistinct() || functionCallExpr.getParams().isStar()) {
throw new AnalysisException(
"The Materialized-View's generic aggregation not support star or distinct");
}
defineExpr = Function.convertToStateCombinator(functionCallExpr);
type = defineExpr.type;
}

View File

@ -20,6 +20,7 @@ package org.apache.doris.catalog;
import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.FunctionCallExpr;
import org.apache.doris.analysis.FunctionName;
import org.apache.doris.analysis.FunctionParams;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.UserException;
@ -853,7 +854,7 @@ public class Function implements Writable {
aggFunction.hasVarArgs(), aggFunction.isUserVisible());
fn.setNullableMode(NullableMode.ALWAYS_NOT_NULLABLE);
fn.setBinaryType(TFunctionBinaryType.AGG_STATE);
return new FunctionCallExpr(fn, fnCall.getParams());
return new FunctionCallExpr(fn, new FunctionParams(fnCall.getChildren()));
}
public static FunctionCallExpr convertToMergeCombinator(FunctionCallExpr fnCall) {

View File

@ -1318,15 +1318,6 @@ public class FunctionSet<T> {
true, false, true, true));
//vec percentile and percentile_approx
addBuiltin(AggregateFunction.createBuiltin("percentile",
Lists.newArrayList(Type.BIGINT, Type.DOUBLE), Type.DOUBLE, Type.VARCHAR,
"",
"",
"",
"",
"",
false, true, false, true));
addBuiltin(AggregateFunction.createBuiltin("percentile_approx",
Lists.<Type>newArrayList(Type.DOUBLE, Type.DOUBLE), Type.DOUBLE, Type.VARCHAR,
"",