924060929 commented on code in PR #69388:
URL: https://github.com/apache/doris/pull/69388#discussion_r4335127245


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindExpression.java:
##########
@@ -1064,10 +1066,10 @@ private LogicalPlan 
bindUsingJoin(MatchingContext<LogicalUsingJoin<Plan, Plan>>
                 mergeExpr = new Alias(new Coalesce(leftSlot, rightSlot), 
colName);
             } else if (joinType.isRightJoin() || 
joinType.isRightSemiOrAntiJoin()) {
                 // RIGHT OUTER / RIGHT SEMI / RIGHT ANTI: use right side 
(preserved side)
-                mergeExpr = new Alias(rightSlot, colName);
+                mergeExpr = rightSlot.withQualifier(ImmutableList.of());
             } else {
                 // LEFT OUTER / INNER / LEFT SEMI / LEFT ANTI / CROSS: use 
left side
-                mergeExpr = new Alias(leftSlot, colName);
+                mergeExpr = leftSlot.withQualifier(ImmutableList.of());

Review Comment:
   Confirmed locally: the reported SQL fails on the original PR head with 
expected column order [x,y,z] but actual [x,z,y]. Fixed in 
363d34b70578aee08231e8082b6a0151ce199ac0.
   
   LogicalCTEConsumer now takes its output from the insertion-ordered 
consumer-to-producer map, whose distinct consumer keys preserve each producer 
position. Nullability adjustment, producer ExprId replacement and variant 
subpath pruning also retain that order when rebuilding the map. The USING-key 
identity fix remains intact.
   
   Added inner/left/right USING CTE order checks with full planning, an actual 
FE-computed repeated-column result check for (1,10,1), and consumer 
copy/pruning/nullability/ExprId replacement tests. All 73 focused FE tests 
passed through run-fe-ut.sh; the full FE build and Checkstyle also passed. The 
result check uses the FE result-computation path; no BE execution is claimed.



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