morrySnow commented on code in PR #62524:
URL: https://github.com/apache/doris/pull/62524#discussion_r3135163213
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExpressionTrait.java:
##########
@@ -46,23 +47,58 @@ default void checkLegalityBeforeTypeCoercion() {}
@Developing
default void checkLegalityAfterRewrite() {}
+ /**
+ * getArguments.
+ */
default List<Expression> getArguments() {
- return children();
+ ImmutableList.Builder<Expression> arguments = ImmutableList.builder();
+ for (Expression arg : children()) {
+ if (arg instanceof Variable && ((Variable)
arg).getRealExpression() != null) {
+ arguments.add(((Variable) arg).getRealExpression());
+ } else {
+ arguments.add(arg);
+ }
+ }
+ return arguments.build();
}
+ /**
+ * getArgument.
+ */
default Expression getArgument(int index) {
- return child(index);
+ Expression arg = child(index);
+ if (arg instanceof Variable && ((Variable) arg).getRealExpression() !=
null) {
+ return ((Variable) arg).getRealExpression();
+ } else {
+ return arg;
+ }
}
+ /**
+ * getArgumentsTypes.
+ */
default List<DataType> getArgumentsTypes() {
Review Comment:
this `function` and `getArgumentType(int index)` should not require any
modification
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExpressionTrait.java:
##########
@@ -46,23 +47,58 @@ default void checkLegalityBeforeTypeCoercion() {}
@Developing
default void checkLegalityAfterRewrite() {}
+ /**
+ * getArguments.
+ */
default List<Expression> getArguments() {
- return children();
+ ImmutableList.Builder<Expression> arguments = ImmutableList.builder();
+ for (Expression arg : children()) {
Review Comment:
If the variable does not exist, then do not return a new list object.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]