morrySnow commented on code in PR #67783:
URL: https://github.com/apache/doris/pull/67783#discussion_r4024144561


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindRelation.java:
##########
@@ -1068,26 +1072,19 @@ public static LogicalPlan 
checkAndAddChangeScanFilter(LogicalOlapScan scan,
         if (scanType.equals(StreamScanType.APPEND_ONLY)) {
             Preconditions.checkArgument(opSlot != null, "opSlot is null");
             return new LogicalFilter<>(ImmutableSet.of(new EqualTo(opSlot,
-                    new BigIntLiteral(BinlogUtils.ROW_BINLOG_APPEND))), plan);
+                    new BigIntLiteral(BinlogUtils.ROW_BINLOG_APPEND))), scan);
         } else if (beforeImageOnly) {
             return new LogicalFilter<>(ImmutableSet.of(new InPredicate(opSlot, 
ImmutableList.of(
                     new BigIntLiteral(BinlogUtils.ROW_BINLOG_DELETE),
-                    new 
BigIntLiteral(BinlogUtils.ROW_BINLOG_UPDATE_BEFORE)))), plan);
+                    new 
BigIntLiteral(BinlogUtils.ROW_BINLOG_UPDATE_BEFORE)))), scan);
         }
-        return plan;
+        return scan;
     }
 
-    private LogicalPlan projectFromOriginSlots(LogicalPlan plan, List<Slot> 
wantedSlots) {
-        Map<String, Slot> childSlotByName = new 
HashMap<>(plan.getOutput().size());
-        for (Slot slot : plan.getOutput()) {
-            childSlotByName.put(slot.getName(), slot);
-        }
+    private LogicalPlan projectFromUnboundSlots(LogicalPlan plan, 
List<UnboundSlot> wantedSlots) {
         List<NamedExpression> project = new ArrayList<>(wantedSlots.size());
-        for (Slot wanted : wantedSlots) {
-            Slot match = childSlotByName.get(wanted.getName());
-            Preconditions.checkArgument(match != null,
-                    "column %s not found in child output", wanted.getName());
-            project.add(new Alias(match, wanted.getName()));
+        for (UnboundSlot wanted : wantedSlots) {
+            project.add(new Alias(wanted, wanted.getName()));

Review Comment:
   Good catch. Follow-up fixed in 40f0315961e: the MOW visible-output 
conversion now builds each `UnboundSlot` with 
`Utils.qualifiedNameParts(slot.getQualifier(), slot.getName())`, so 
`projectFromUnboundSlots` receives `[qualifier..., rawName]` and can preserve 
both the alias qualifier and raw column name. Added an FE test that asserts 
both union-branch projection aliases retain `[internal, test_stream, 
tbl_stream_base]`; the assertion fails before this fix and passes afterward. 
The targeted test plus `CheckRowPolicyTest` pass (12/12).



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