[fix](covar) Fix covar nullable on branch-2.1 (#40841)
covar should not be always nullable. This fix on branch-2.1 makes covar same with master on FE.
This commit is contained in:
@ -19,7 +19,6 @@ package org.apache.doris.nereids.trees.expressions.functions.agg;
|
||||
|
||||
import org.apache.doris.catalog.FunctionSignature;
|
||||
import org.apache.doris.nereids.trees.expressions.Expression;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
|
||||
import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
|
||||
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
|
||||
@ -38,8 +37,8 @@ import java.util.List;
|
||||
/**
|
||||
* AggregateFunction 'covar'. This class is generated by GenerateFunction.
|
||||
*/
|
||||
public class Covar extends AggregateFunction
|
||||
implements UnaryExpression, ExplicitlyCastableSignature, AlwaysNullable {
|
||||
public class Covar extends NullableAggregateFunction
|
||||
implements UnaryExpression, ExplicitlyCastableSignature {
|
||||
|
||||
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
|
||||
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE, DoubleType.INSTANCE),
|
||||
@ -54,14 +53,18 @@ public class Covar extends AggregateFunction
|
||||
* constructor with 2 argument.
|
||||
*/
|
||||
public Covar(Expression arg1, Expression arg2) {
|
||||
super("covar", arg1, arg2);
|
||||
this(false, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor with 3 arguments.
|
||||
*/
|
||||
public Covar(boolean distinct, Expression arg1, Expression arg2) {
|
||||
super("covar", distinct, arg1, arg2);
|
||||
this(distinct, false, arg1, arg2);
|
||||
}
|
||||
|
||||
public Covar(boolean distinct, boolean alwaysNullable, Expression arg1, Expression arg2) {
|
||||
super("covar", distinct, alwaysNullable, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +73,12 @@ public class Covar extends AggregateFunction
|
||||
@Override
|
||||
public Covar withDistinctAndChildren(boolean distinct, List<Expression> children) {
|
||||
Preconditions.checkArgument(children.size() == 2);
|
||||
return new Covar(distinct, children.get(0), children.get(1));
|
||||
return new Covar(distinct, alwaysNullable, children.get(0), children.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Covar withAlwaysNullable(boolean alwaysNullable) {
|
||||
return new Covar(distinct, alwaysNullable, children.get(0), children.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user