This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c2edca7bda [fix](Nereids) construct project with all slots in 
semi-semi-transpose-project rule (#17811)
c2edca7bda is described below

commit c2edca7bda6315af9cf7d60f773bb23e954a6806
Author: 谢健 <jianx...@gmail.com>
AuthorDate: Thu Mar 16 11:53:32 2023 +0800

    [fix](Nereids) construct project with all slots in 
semi-semi-transpose-project rule (#17811)
    
    error msg in tpch 20
    ```
    SlotRef have invalid slot id: , desc: 22, slot_desc: tuple_desc_map: 
[Tuple(id=10 slots=[Slot(id=51 type=DECIMALV2(27, 9) col=-1, colname= 
null=(offset=0 mask=80)), Slot(id=52 type=INT col=-1, colname= null=(offset=0 
mask=0)), Slot(id=53 type=INT col=-1, colname= null=(offset=0 mask=0)), 
Slot(id=54 type=INT col=-1, colname= null=(offset=0 mask=0)), Slot(id=55 
type=INT col=-1, colname= null=(offset=0 mask=0))] has_varlen_slots=0)] 
tuple_id_map: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  [...]
    ```
    
    Before we only use slots in `hashJoin` conditions to construct projects, 
which may lost some slots in `project`, such as
    ```
    LOGICAL_SEMI_JOIN_LOGICAL_JOIN_TRANSPOSE_PROJECT
    
    LogicalJoin[1135] ( type=LEFT_SEMI_JOIN, 
markJoinSlotReference=Optional.empty, hashJoinConjuncts=[(PS_PARTKEY#0 = 
P_PARTKEY#6)], otherJoinConjuncts=[] )
    |--LogicalProject[1128] ( distinct=false, projects=[PS_PARTKEY#0, 
PS_SUPPKEY#1], excepts=[], canEliminate=true )
    |  +--LogicalJoin[1120] ( type=LEFT_SEMI_JOIN, 
markJoinSlotReference=Optional.empty, hashJoinConjuncts=[(L_PARTKEY#17 = 
PS_PARTKEY#0), (L_SUPPKEY#18 = PS_SUPPKEY#1)], 
otherJoinConjuncts=[(cast(PS_AVAILQTY#2 as DECIMAL(27, 9)) > (0.5 * 
sum(L_QUANTITY))#33)] )
    |     |--GroupPlan( GroupId#2 )
    |     +--GroupPlan( GroupId#7 )
    +--GroupPlan( GroupId#12 )
    ----------------------after----------------------
    LogicalJoin[1141] ( type=LEFT_SEMI_JOIN, 
markJoinSlotReference=Optional.empty, hashJoinConjuncts=[(L_PARTKEY#17 = 
PS_PARTKEY#0), (L_SUPPKEY#18 = PS_SUPPKEY#1)], 
otherJoinConjuncts=[(cast(PS_AVAILQTY#2 as DECIMAL(27, 9)) > (0.5 * 
sum(L_QUANTITY))#33)] )
    |--LogicalProject[1140] ( distinct=false, projects=[PS_PARTKEY#0, 
PS_SUPPKEY#1], excepts=[], canEliminate=true )
    |  +--LogicalJoin[1139] ( type=LEFT_SEMI_JOIN, 
markJoinSlotReference=Optional.empty, hashJoinConjuncts=[(PS_PARTKEY#0 = 
P_PARTKEY#6)], otherJoinConjuncts=[] )
    |     |--GroupPlan( GroupId#2 )
    |     +--GroupPlan( GroupId#12 )
    +--GroupPlan( GroupId#7 )
    ```
    `PS_AVAILQTY#2` lost in project
    
    Now we use all slots to construct projest
---
 .../exploration/join/SemiJoinSemiJoinTransposeProject.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProject.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProject.java
index 73af2fc191..ecd255e01a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProject.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProject.java
@@ -65,14 +65,12 @@ public class SemiJoinSemiJoinTransposeProject extends 
OneExplorationRuleFactory
                     Set<ExprId> aOutputExprIdSet = a.getOutputExprIdSet();
                     Set<NamedExpression> acProjects = new 
HashSet<NamedExpression>(abProject.getProjects());
 
-                    bottomSemi.getHashJoinConjuncts().forEach(
-                            expression -> expression.getInputSlots().forEach(
-                                    slot -> {
-                                        if 
(aOutputExprIdSet.contains(slot.getExprId())) {
-                                            acProjects.add(slot);
-                                        }
-                                    })
-                    );
+                    bottomSemi.getConditionSlot()
+                            .forEach(slot -> {
+                                if 
(aOutputExprIdSet.contains(slot.getExprId())) {
+                                    acProjects.add(slot);
+                                }
+                            });
                     LogicalJoin newBottomSemi = (LogicalJoin) 
topSemi.withChildren(a, c);
                     
newBottomSemi.getJoinReorderContext().copyFrom(bottomSemi.getJoinReorderContext());
                     newBottomSemi.getJoinReorderContext().setHasCommute(false);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to