[fix](planner) fix ifnull and nvl function with one parameters exception message anbugious (#31808)

When ifnull or nvl funtion have only one parameter, nereids planner would throw an exception and go back to
original planner/ Original planner get secend parameter directly without check, so it return unexpected error message
This commit is contained in:
LiBinfeng
2024-03-06 10:01:00 +08:00
committed by yiguolei
parent 9af64d848f
commit 7f3a666fac
4 changed files with 34 additions and 1 deletions

View File

@ -1543,6 +1543,8 @@ public class FunctionCallExpr extends Expr {
} else if (fnName.getFunction().equalsIgnoreCase("ifnull")
|| fnName.getFunction().equalsIgnoreCase("nvl")) {
Preconditions.checkArgument(children != null && children.size() == 2,
"The " + fnName + " function must have two params");
Type[] childTypes = collectChildReturnTypes();
Type assignmentCompatibleType = ScalarType.getAssignmentCompatibleType(childTypes[0], childTypes[1], true,
enableDecimal256);