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 3674e003ff [fix](projection)join node should always output at least 
one column (#12080)
3674e003ff is described below

commit 3674e003ffcfa9031b3d6ebad7e66dd6ea215d7f
Author: starocean999 <[email protected]>
AuthorDate: Fri Aug 26 12:15:51 2022 +0800

    [fix](projection)join node should always output at least one column (#12080)
---
 .../java/org/apache/doris/planner/HashJoinNode.java    | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 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 49db8ce504..8f255ba88b 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
@@ -226,14 +226,26 @@ public class HashJoinNode extends PlanNode {
                 outputTupleDescList.add(analyzer.getTupleDesc(tupleId));
             }
         }
+        SlotId firstMaterializedSlotId = null;
         for (TupleDescriptor tupleDescriptor : outputTupleDescList) {
             for (SlotDescriptor slotDescriptor : tupleDescriptor.getSlots()) {
-                if (slotDescriptor.isMaterialized()
-                        && (requiredSlotIdSet == null || 
requiredSlotIdSet.contains(slotDescriptor.getId()))) {
-                    outputSlotIds.add(slotDescriptor.getId());
+                if (slotDescriptor.isMaterialized()) {
+                    if ((requiredSlotIdSet == null || 
requiredSlotIdSet.contains(slotDescriptor.getId()))) {
+                        outputSlotIds.add(slotDescriptor.getId());
+                    }
+                    if (firstMaterializedSlotId == null) {
+                        firstMaterializedSlotId = slotDescriptor.getId();
+                    }
                 }
             }
         }
+
+        // be may be possible to output correct row number without any column 
data in future
+        // but for now, in order to have correct output row number, should 
keep at least one slot.
+        // use first materialized slot if outputSlotIds is empty.
+        if (outputSlotIds.isEmpty() && firstMaterializedSlotId != null) {
+            outputSlotIds.add(firstMaterializedSlotId);
+        }
         initHashOutputSlotIds(outputSlotIds, analyzer);
     }
 


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

Reply via email to