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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 62a756e552e branch-4.0: [opt](fe) opt the performance for 
TupleDescriptor.getSlot #60115 (#60338)
62a756e552e is described below

commit 62a756e552ed15396d52115d9f8a9150c23a04e6
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jan 30 20:18:19 2026 +0800

    branch-4.0: [opt](fe) opt the performance for TupleDescriptor.getSlot 
#60115 (#60338)
    
    Cherry-picked from #60115
    
    Co-authored-by: camby <[email protected]>
---
 .../main/java/org/apache/doris/analysis/TupleDescriptor.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
index 2c9f2b65ff2..cf110e447ee 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
@@ -28,12 +28,14 @@ import com.google.common.base.MoreObjects;
 import com.google.common.collect.Lists;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 public class TupleDescriptor {
     private final TupleId id;
     private final String debugName; // debug only
     private final ArrayList<SlotDescriptor> slots;
+    private final HashMap<Integer, SlotDescriptor> idToSlotDesc;
 
     // underlying table, if there is one
     private TableIf table;
@@ -45,17 +47,20 @@ public class TupleDescriptor {
     public TupleDescriptor(TupleId id) {
         this.id = id;
         this.slots = new ArrayList<SlotDescriptor>();
+        this.idToSlotDesc = new HashMap<>();
         this.debugName = "";
     }
 
     public TupleDescriptor(TupleId id, String debugName) {
         this.id = id;
         this.slots = new ArrayList<SlotDescriptor>();
+        this.idToSlotDesc = new HashMap<>();
         this.debugName = debugName;
     }
 
     public void addSlot(SlotDescriptor desc) {
         slots.add(desc);
+        idToSlotDesc.putIfAbsent(desc.getId().asInt(), desc);
     }
 
     public TupleId getId() {
@@ -81,12 +86,7 @@ public class TupleDescriptor {
      * @return this slot's desc
      */
     public SlotDescriptor getSlot(int slotId) {
-        for (SlotDescriptor slotDesc : slots) {
-            if (slotDesc.getId().asInt() == slotId) {
-                return slotDesc;
-            }
-        }
-        return null;
+        return idToSlotDesc.get(slotId);
     }
 
     public ArrayList<SlotId> getAllSlotIds() {


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

Reply via email to