englefly commented on code in PR #69787:
URL: https://github.com/apache/doris/pull/69787#discussion_r4441715503


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java:
##########
@@ -471,14 +471,125 @@ public Plan visitLogicalSink(LogicalSink<? extends Plan> 
rewrittenPlan, Void con
                     
normalizedOutputExprList.add(normalizeExpression(originalExpression,
                             rewrittenExpression, true));
                 }
-                LogicalProject<Plan> project = new 
LogicalProject<>(normalizedOutputExprList,
-                        rewrittenPlan.child());
-                return rewrittenPlan.withChildren(project);
+                // Set the outputs on the sink itself. A project between the 
sink and the child would only
+                // pass the child outputs through with a changed nullable 
property, and the slot of such a
+                // project does not describe the expression which produces it: 
a rule which merges the
+                // projects, e.g. MergeProjectsCBO, then derives the original 
nullable property again and
+                // the plan no longer matches the logical properties of the 
group it is inserted into.
+                return rewrittenPlan.withOutputExprs(normalizedOutputExprList);

Review Comment:
   fileSink 里的alias 不会被翻译, 所以需要再fileSink 下增加一个project



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