[Chore](function) set normal function use_default_implementation_for_constants to default (#27891)

set normal function use_default_implementation_for_constants to default
This commit is contained in:
Pxl
2023-12-04 14:19:25 +08:00
committed by GitHub
parent e19af1b2ed
commit 2b715924c5
12 changed files with 34 additions and 57 deletions

View File

@ -18,6 +18,7 @@
package org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.exceptions.AnalysisException;
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;
@ -52,6 +53,16 @@ public class SubstringIndex extends ScalarFunction
super("substring_index", arg0, arg1, arg2);
}
@Override
public void checkLegalityBeforeTypeCoercion() {
for (int i = 1; i < children.size(); ++i) {
if (!getArgument(i).isConstant()) {
throw new AnalysisException(getName()
+ " function except for the first argument, other parameter must be a constant.");
}
}
}
/**
* withChildren.
*/