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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new bba98b9122 [fix](projection)sort node's unmaterialized slots should be 
removed from resolvedTupleExprs (#13003)
bba98b9122 is described below

commit bba98b91223c83eced3d36342a7c1fd4591b7ee8
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Tue Sep 27 12:16:26 2022 +0800

    [fix](projection)sort node's unmaterialized slots should be removed from 
resolvedTupleExprs (#13003)
---
 .../main/java/org/apache/doris/planner/SortNode.java    | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SortNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/SortNode.java
index 0cd5294dd6..18a81741a5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SortNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SortNode.java
@@ -40,6 +40,7 @@ import com.google.common.collect.Lists;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -156,13 +157,14 @@ public class SortNode extends PlanNode {
     @Override
     public Set<SlotId> computeInputSlotIds(Analyzer analyzer) throws 
NotImplementedException {
         List<SlotDescriptor> slotDescriptorList = 
this.info.getSortTupleDescriptor().getSlots();
+        List<Expr> materializedTupleExprs = new 
ArrayList<>(resolvedTupleExprs);
         for (int i = slotDescriptorList.size() - 1; i >= 0; i--) {
             if (!slotDescriptorList.get(i).isMaterialized()) {
-                resolvedTupleExprs.remove(i);
+                materializedTupleExprs.remove(i);
             }
         }
         List<SlotId> result = Lists.newArrayList();
-        Expr.getIds(resolvedTupleExprs, null, result);
+        Expr.getIds(materializedTupleExprs, null, result);
         return new HashSet<>(result);
     }
 
@@ -185,7 +187,16 @@ public class SortNode extends PlanNode {
                 info.getIsAscOrder(),
                 info.getNullsFirst());
         Preconditions.checkState(tupleIds.size() == 1, "Incorrect size for 
tupleIds in SortNode");
-        sortInfo.setSortTupleSlotExprs(Expr.treesToThrift(resolvedTupleExprs));
+        if (resolvedTupleExprs != null) {
+            List<SlotDescriptor> slotDescriptorList = 
this.info.getSortTupleDescriptor().getSlots();
+            for (int i = slotDescriptorList.size() - 1; i >= 0; i--) {
+                if (!slotDescriptorList.get(i).isMaterialized()) {
+                    resolvedTupleExprs.remove(i);
+                }
+            }
+            
sortInfo.setSortTupleSlotExprs(Expr.treesToThrift(resolvedTupleExprs));
+        }
+        
         TSortNode sortNode = new TSortNode(sortInfo, useTopN);
 
         msg.sort_node = sortNode;


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

Reply via email to