xinyiZzz commented on a change in pull request #6380: URL: https://github.com/apache/incubator-doris/pull/6380#discussion_r685703603
########## File path: fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java ########## @@ -1838,6 +1837,11 @@ public PlanNode createJoinNode(Analyzer analyzer, PlanNode outer, PlanNode inner */ private PlanNode createJoinNode(Analyzer analyzer, PlanNode outer, TableRef innerRef, SelectStmt selectStmt) throws UserException { + // Before creating a build node, ensure that all required slots are materialized, + // even if slots that are not needed by Statement outside. + // Otherwise, when select stmt and on-clause does not contain the Slot of the Union Node on the right side of Join, + // it will cause an error, see Doris-6380. + materializeTableResultForCrossJoinOrCountStar(innerRef, analyzer); Review comment: I understand to ensure that resultExprs/constExprs and the corresponding output slot are materialized in the same state. The output slot is materialized at various positions in the planner stage. So I moved the materialized position of resultExprs/constExprs from this.init to this.finalize. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org