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 811d8f197e2 branch-4.0: [fix](prune nested column) fix prune nested 
column maybe throw NullPointerException #60395 (#60444)
811d8f197e2 is described below

commit 811d8f197e269f7eadc11d88ec2abcdd8b2a948f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Feb 3 10:41:25 2026 +0800

    branch-4.0: [fix](prune nested column) fix prune nested column maybe throw 
NullPointerException #60395 (#60444)
    
    Cherry-picked from #60395
    
    Co-authored-by: 924060929 <[email protected]>
---
 .../rules/rewrite/AccessPathPlanCollector.java     | 15 ++++++++++++-
 .../rules/rewrite/PruneNestedColumnTest.java       | 25 ++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
index e525774961a..48886c0773e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
@@ -222,7 +222,20 @@ public class AccessPathPlanCollector extends 
DefaultPlanVisitor<Void, StatementC
                 Slot innerSlot = (Slot) output.child(0);
                 Collection<CollectAccessPathResult> outerSlotAccessPaths = 
allSlotToAccessPaths.get(
                         output.getExprId().asInt());
-                allSlotToAccessPaths.putAll(innerSlot.getExprId().asInt(), 
outerSlotAccessPaths);
+                for (CollectAccessPathResult outerSlotAccessPath : 
outerSlotAccessPaths) {
+                    List<String> outerPath = outerSlotAccessPath.getPath();
+                    List<String> replaceSlotNamePath = new ArrayList<>();
+                    replaceSlotNamePath.add(innerSlot.getName());
+                    replaceSlotNamePath.addAll(outerPath.subList(1, 
outerPath.size()));
+                    allSlotToAccessPaths.put(
+                            innerSlot.getExprId().asInt(),
+                            new CollectAccessPathResult(
+                                    replaceSlotNamePath,
+                                    outerSlotAccessPath.isPredicate(),
+                                    outerSlotAccessPath.getType()
+                            )
+                    );
+                }
             } else {
                 exprCollector.collect(output);
             }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java
index 4ff8a82cd7c..5ea5fc5b3fb 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java
@@ -284,6 +284,31 @@ public class PruneNestedColumnTest extends 
TestWithFeService implements MemoPatt
                 ImmutableList.of(path("s", "data", "*", "*", "b")),
                 ImmutableList.of()
         );
+
+        createTable(
+                "CREATE TABLE `view_baseall_drop_nereids` (\n"
+                        + "            `k1` int(11) NULL,\n"
+                        + "            `k3` array<int> NULL\n"
+                        + "        ) ENGINE=OLAP\n"
+                        + "        DUPLICATE KEY(`k1`)\n"
+                        + "        COMMENT 'OLAP'\n"
+                        + "        DISTRIBUTED BY HASH(`k1`) BUCKETS 5\n"
+                        + "        PROPERTIES (\n"
+                        + "        \"replication_allocation\" = 
\"tag.location.default: 1\",\n"
+                        + "        \"is_being_synced\" = \"false\",\n"
+                        + "        \"storage_format\" = \"V2\",\n"
+                        + "        \"light_schema_change\" = \"true\",\n"
+                        + "        \"disable_auto_compaction\" = \"false\",\n"
+                        + "        \"enable_single_replica_compaction\" = 
\"false\"\n"
+                        + "        )"
+        );
+        createView("create view IF NOT EXISTS test_view7_drop_nereids 
(k1,k2,k3,k4) as\n"
+                + "            select *, 
array_filter(x->x>0,k3),array_filter(`k3`, array_map(x -> x > 0, `k3`)) from 
view_baseall_drop_nereids order by k1");
+        assertColumn("select * from test_view7_drop_nereids order by k1",
+                "array<int>",
+                ImmutableList.of(path("k3")),
+                ImmutableList.of()
+        );
     }
 
     @Test


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

Reply via email to