github-actions[bot] commented on code in PR #65472:
URL: https://github.com/apache/doris/pull/65472#discussion_r3575691166


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PullUpJoinFromUnionAll.java:
##########
@@ -577,14 +577,14 @@ boolean isNotSupported(Plan plan) {
         }
 
         boolean comparePlan(Plan plan1, Plan plan2) {
+            if (plan1.getOutput().size() != plan2.getOutput().size()) {

Review Comment:
   This guard is still too weak because same-table `LogicalOlapScan` nodes can 
have the same output count while representing different scan identities. Two 
production shapes reach this rule before nested-column pruning:
   
   ```text
   UnionAll
     Project(t.b)
       Join(LogicalOlapScan(t INDEX mv_ab) -> [a, b], o1, on a = o1.k)
     Project(t.c)
       Join(LogicalOlapScan(t INDEX mv_ac) -> [a, c], o2, on a = o2.k)
   ```
   
   `BindRelation` can create these direct selected-index scans before this 
rewrite, and `computeOutput()` uses the selected index schema. Both scans have 
the same `TableIdentifier` and arity, so this comparator maps outputs 
positionally and can replace the second branch's `c` with the first branch's 
`b`.
   
   The same root cause applies even when outputs are identical but scan scope 
differs, for example `LogicalOlapScan(t PARTITION p1)` vs `LogicalOlapScan(t 
PARTITION p2)` or different manually selected tablets. After the comparator 
treats them as the same common side, `constructNewJoin()` keeps only the first 
scan as `newCommon`, so the second arm reads the wrong partition/tablet scope.
   
   Please require full `LogicalOlapScan` identity before recording the 
positional slot map, including selected index/output-column identity and 
row-set restrictions such as selected/manual partitions and tablets, or reject 
non-identical catalog-relation common sides.
   



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