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

yiguolei pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/dev-1.1.2 by this push:
     new 8ccd5faa59 [dev-1.1.2](join)the hash join node would get the wrong 
nullable if the child node is cross join node (#12028)
8ccd5faa59 is described below

commit 8ccd5faa591f3ea2c4268db1e32af16d56a2402f
Author: starocean999 <[email protected]>
AuthorDate: Wed Aug 24 14:22:11 2022 +0800

    [dev-1.1.2](join)the hash join node would get the wrong nullable if the 
child node is cross join node (#12028)
---
 .../main/java/org/apache/doris/planner/HashJoinNode.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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 f0c20ebec1..49db8ce504 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
@@ -366,6 +366,11 @@ public class HashJoinNode extends PlanNode {
         int rightNullableNumber = 0;
         if (copyLeft) {
             for (TupleDescriptor leftTupleDesc : 
analyzer.getDescTbl().getTupleDesc(getChild(0).getOutputTblRefIds())) {
+                // if the child is cross join node, the only way to get the 
correct nullable info of its output slots
+                // is to check if the output tuple ids are outer joined or not.
+                // then pass this nullable info to hash join node will be 
correct.
+                boolean needSetToNullable =
+                        getChild(0) instanceof CrossJoinNode && 
analyzer.isOuterJoined(leftTupleDesc.getId());
                 for (SlotDescriptor leftSlotDesc : leftTupleDesc.getSlots()) {
                     if (!isMaterailizedByChild(leftSlotDesc, 
getChild(0).getOutputSmap())) {
                         continue;
@@ -376,6 +381,9 @@ public class HashJoinNode extends PlanNode {
                         outputSlotDesc.setIsNullable(true);
                         leftNullableNumber++;
                     }
+                    if (needSetToNullable) {
+                        outputSlotDesc.setIsNullable(true);
+                    }
                     srcTblRefToOutputTupleSmap.put(new SlotRef(leftSlotDesc), 
new SlotRef(outputSlotDesc));
                 }
             }
@@ -383,6 +391,8 @@ public class HashJoinNode extends PlanNode {
         if (copyRight) {
             for (TupleDescriptor rightTupleDesc :
                     
analyzer.getDescTbl().getTupleDesc(getChild(1).getOutputTblRefIds())) {
+                boolean needSetToNullable =
+                        getChild(1) instanceof CrossJoinNode && 
analyzer.isOuterJoined(rightTupleDesc.getId());
                 for (SlotDescriptor rightSlotDesc : rightTupleDesc.getSlots()) 
{
                     if (!isMaterailizedByChild(rightSlotDesc, 
getChild(1).getOutputSmap())) {
                         continue;
@@ -393,6 +403,9 @@ public class HashJoinNode extends PlanNode {
                         outputSlotDesc.setIsNullable(true);
                         rightNullableNumber++;
                     }
+                    if (needSetToNullable) {
+                        outputSlotDesc.setIsNullable(true);
+                    }
                     srcTblRefToOutputTupleSmap.put(new SlotRef(rightSlotDesc), 
new SlotRef(outputSlotDesc));
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to