feiniaofeiafei commented on code in PR #56942:
URL: https://github.com/apache/doris/pull/56942#discussion_r2451495608


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExprIdRewriter.java:
##########
@@ -100,7 +105,43 @@ public List<ExpressionPatternMatcher<? extends 
Expression>> buildRules() {
                                 lastId = newId;
                             }
                         }
-                    }).toRule(ExpressionRuleType.EXPR_ID_REWRITE_REPLACE)
+                    }).toRule(ExpressionRuleType.EXPR_ID_REWRITE_REPLACE),
+                    matchesType(VirtualSlotReference.class).thenApply(ctx -> {
+                        VirtualSlotReference virtualSlot = ctx.expr;
+                        Optional<GroupingScalarFunction> originExpression = 
virtualSlot.getOriginExpression();
+                        if (!originExpression.isPresent()) {
+                            return virtualSlot;
+                        }
+                        List<Expression> newChildren = new ArrayList<>();
+                        List<Expression> oldChildren = 
originExpression.get().children();
+                        for (Expression child : oldChildren) {

Review Comment:
   1. directly traverse the originExpression instead of using for loop 
traversing originExpression children maybe better.
   



-- 
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]

Reply via email to