You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by li...@apache.org on 2022/07/14 11:55:43 UTC

[doris] branch repair_outer_join_0714 updated: semi/anti join + empty other conjuncts = semi copy (#10857)

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

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


The following commit(s) were added to refs/heads/repair_outer_join_0714 by this push:
     new 79a464bd95 semi/anti join + empty other conjuncts = semi copy (#10857)
79a464bd95 is described below

commit 79a464bd955d08fa3425aafc47e8be664be25bda
Author: EmmyMiao87 <52...@qq.com>
AuthorDate: Thu Jul 14 19:55:39 2022 +0800

    semi/anti join + empty other conjuncts = semi copy (#10857)
---
 .../org/apache/doris/planner/HashJoinNode.java     | 53 +++++++++++++++-------
 1 file changed, 37 insertions(+), 16 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java
index 7eda81014a..78eb563ec7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java
@@ -554,6 +554,8 @@ public class HashJoinNode extends PlanNode {
         vIntermediateTupleDescList.add(vIntermediateRightTupleDesc);
         boolean leftNullable = false;
         boolean rightNullable = false;
+        boolean copyleft = true;
+        boolean copyRight = true;
         switch (joinOp) {
             case LEFT_OUTER_JOIN:
                 rightNullable = true;
@@ -565,6 +567,19 @@ public class HashJoinNode extends PlanNode {
                 leftNullable = true;
                 rightNullable = true;
                 break;
+            case LEFT_ANTI_JOIN:
+            case LEFT_SEMI_JOIN:
+            case NULL_AWARE_LEFT_ANTI_JOIN:
+                if (otherJoinConjuncts == null || otherJoinConjuncts.isEmpty()) {
+                    copyRight = false;
+                }
+                break;
+            case RIGHT_SEMI_JOIN:
+            case RIGHT_ANTI_JOIN:
+                if (otherJoinConjuncts == null || otherJoinConjuncts.isEmpty()) {
+                    copyleft = false;
+                }
+                break;
             default:
                 break;
         }
@@ -572,28 +587,34 @@ public class HashJoinNode extends PlanNode {
         ExprSubstitutionMap originToIntermediateSmap = new ExprSubstitutionMap();
         Map<List<TupleId>, TupleId> originTidsToIntermediateTidMap = Maps.newHashMap();
         // left
-        originTidsToIntermediateTidMap.put(getChild(0).getOutputTupleIds(), vIntermediateLeftTupleDesc.getId());
-        for (TupleDescriptor tupleDescriptor : analyzer.getDescTbl().getTupleDesc(getChild(0).getOutputTupleIds())) {
-            for (SlotDescriptor slotDescriptor : tupleDescriptor.getMaterializedSlots()) {
-                SlotDescriptor intermediateSlotDesc =
-                        analyzer.getDescTbl().copySlotDescriptor(vIntermediateLeftTupleDesc, slotDescriptor);
-                if (leftNullable) {
-                    intermediateSlotDesc.setIsNullable(true);
+        if (copyleft) {
+            originTidsToIntermediateTidMap.put(getChild(0).getOutputTupleIds(), vIntermediateLeftTupleDesc.getId());
+            for (TupleDescriptor tupleDescriptor : analyzer.getDescTbl()
+                    .getTupleDesc(getChild(0).getOutputTupleIds())) {
+                for (SlotDescriptor slotDescriptor : tupleDescriptor.getMaterializedSlots()) {
+                    SlotDescriptor intermediateSlotDesc =
+                            analyzer.getDescTbl().copySlotDescriptor(vIntermediateLeftTupleDesc, slotDescriptor);
+                    if (leftNullable) {
+                        intermediateSlotDesc.setIsNullable(true);
+                    }
+                    originToIntermediateSmap.put(new SlotRef(slotDescriptor), new SlotRef(intermediateSlotDesc));
                 }
-                originToIntermediateSmap.put(new SlotRef(slotDescriptor), new SlotRef(intermediateSlotDesc));
             }
         }
         vIntermediateLeftTupleDesc.computeMemLayout();
         // right
-        originTidsToIntermediateTidMap.put(getChild(1).getOutputTupleIds(), vIntermediateRightTupleDesc.getId());
-        for (TupleDescriptor tupleDescriptor : analyzer.getDescTbl().getTupleDesc(getChild(1).getOutputTupleIds())) {
-            for (SlotDescriptor slotDescriptor : tupleDescriptor.getMaterializedSlots()) {
-                SlotDescriptor intermediateSlotDesc =
-                        analyzer.getDescTbl().copySlotDescriptor(vIntermediateRightTupleDesc, slotDescriptor);
-                if (rightNullable) {
-                    intermediateSlotDesc.setIsNullable(true);
+        if (copyRight) {
+            originTidsToIntermediateTidMap.put(getChild(1).getOutputTupleIds(), vIntermediateRightTupleDesc.getId());
+            for (TupleDescriptor tupleDescriptor : analyzer.getDescTbl()
+                    .getTupleDesc(getChild(1).getOutputTupleIds())) {
+                for (SlotDescriptor slotDescriptor : tupleDescriptor.getMaterializedSlots()) {
+                    SlotDescriptor intermediateSlotDesc =
+                            analyzer.getDescTbl().copySlotDescriptor(vIntermediateRightTupleDesc, slotDescriptor);
+                    if (rightNullable) {
+                        intermediateSlotDesc.setIsNullable(true);
+                    }
+                    originToIntermediateSmap.put(new SlotRef(slotDescriptor), new SlotRef(intermediateSlotDesc));
                 }
-                originToIntermediateSmap.put(new SlotRef(slotDescriptor), new SlotRef(intermediateSlotDesc));
             }
         }
         vIntermediateRightTupleDesc.computeMemLayout();


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