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

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


The following commit(s) were added to refs/heads/nested_column_prune by this 
push:
     new 8ceba565a82 fix "Index 2 out of bounds for length 2" when use tvf
8ceba565a82 is described below

commit 8ceba565a82923122b0696144c6654b419249340
Author: 924060929 <[email protected]>
AuthorDate: Wed Oct 29 11:17:41 2025 +0800

    fix "Index 2 out of bounds for length 2" when use tvf
---
 .../main/java/org/apache/doris/datasource/FileScanNode.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileScanNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileScanNode.java
index 6a617f32e88..08a757ed94e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileScanNode.java
@@ -40,6 +40,7 @@ import org.apache.doris.thrift.TScanRangeLocations;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 
 import java.util.Collections;
@@ -198,10 +199,12 @@ public abstract class FileScanNode extends 
ExternalScanNode {
         TExpr tExpr = new TExpr();
         tExpr.setNodes(Lists.newArrayList());
 
-        int index = 0;
-        List<SlotDescriptor> slots = desc.getSlots();
+        Map<String, SlotDescriptor> nameToSlotDesc = Maps.newLinkedHashMap();
+        for (SlotDescriptor slot : desc.getSlots()) {
+            nameToSlotDesc.put(slot.getColumn().getName(), slot);
+        }
+
         for (Column column : getColumns()) {
-            SlotDescriptor slotDescriptor = slots.get(index++);
             Expr expr;
             if (column.getDefaultValue() != null) {
                 if (column.getDefaultValueExprDef() != null) {
@@ -215,9 +218,10 @@ public abstract class FileScanNode extends 
ExternalScanNode {
                     if (useVarcharAsNull) {
                         expr = 
NullLiteral.create(org.apache.doris.catalog.Type.VARCHAR);
                     } else {
+                        SlotDescriptor slotDescriptor = 
nameToSlotDesc.get(column.getName());
                         // the nested type(map/array/struct) maybe pruned,
                         // we should use the pruned type to avoid be core
-                        expr = NullLiteral.create(slotDescriptor.getType());
+                        expr = NullLiteral.create(slotDescriptor == null ? 
column.getType() : slotDescriptor.getType());
                     }
                 } else {
                     expr = null;


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

Reply via email to