From c1167f6ea520e444a4a414a1f8a239e4aa66676b Mon Sep 17 00:00:00 2001 From: 924060929 Date: Fri, 30 Jan 2026 19:04:37 +0800 Subject: [PATCH 1/3] fix --- .../rewrite/AccessPathPlanCollector.java | 16 +++++++++++- .../rules/rewrite/PruneNestedColumnTest.java | 25 +++++++++++++++++++ 2 files changed, 40 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 e525774961a3c4..e2e1e136d57163 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 @@ -47,6 +47,7 @@ import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanVisitor; import org.apache.doris.nereids.types.NestedColumnPrunable; +import com.google.common.collect.ImmutableList; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; @@ -222,7 +223,20 @@ public Void visitLogicalProject(LogicalProject project, Statemen Slot innerSlot = (Slot) output.child(0); Collection outerSlotAccessPaths = allSlotToAccessPaths.get( output.getExprId().asInt()); - allSlotToAccessPaths.putAll(innerSlot.getExprId().asInt(), outerSlotAccessPaths); + // for (CollectAccessPathResult outerSlotAccessPath : outerSlotAccessPaths) { + // List outerPath = outerSlotAccessPath.getPath(); + // List 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()) + // ); + // } + allSlotToAccessPaths.putAll( + innerSlot.getExprId().asInt(), + outerSlotAccessPaths + ); } 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 4ff8a82cd7cca1..5ea5fc5b3fbf97 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 void testProject() throws Exception { ImmutableList.of(path("s", "data", "*", "*", "b")), ImmutableList.of() ); + + createTable( + "CREATE TABLE `view_baseall_drop_nereids` (\n" + + " `k1` int(11) NULL,\n" + + " `k3` array 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", + ImmutableList.of(path("k3")), + ImmutableList.of() + ); } @Test From 856f226b88844ec9edf870c820a13b3cc1d5915b Mon Sep 17 00:00:00 2001 From: 924060929 Date: Fri, 30 Jan 2026 19:06:50 +0800 Subject: [PATCH 2/3] fix --- .../rewrite/AccessPathPlanCollector.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) 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 e2e1e136d57163..007d183cd57b14 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 @@ -47,7 +47,6 @@ import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanVisitor; import org.apache.doris.nereids.types.NestedColumnPrunable; -import com.google.common.collect.ImmutableList; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; @@ -223,20 +222,16 @@ public Void visitLogicalProject(LogicalProject project, Statemen Slot innerSlot = (Slot) output.child(0); Collection outerSlotAccessPaths = allSlotToAccessPaths.get( output.getExprId().asInt()); - // for (CollectAccessPathResult outerSlotAccessPath : outerSlotAccessPaths) { - // List outerPath = outerSlotAccessPath.getPath(); - // List 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()) - // ); - // } - allSlotToAccessPaths.putAll( - innerSlot.getExprId().asInt(), - outerSlotAccessPaths - ); + for (CollectAccessPathResult outerSlotAccessPath : outerSlotAccessPaths) { + List outerPath = outerSlotAccessPath.getPath(); + List 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); } From 92e36c9317a151c4bc912c52e735aa1f8c3f19ba Mon Sep 17 00:00:00 2001 From: 924060929 Date: Fri, 30 Jan 2026 19:15:30 +0800 Subject: [PATCH 3/3] fix --- .../nereids/rules/rewrite/AccessPathPlanCollector.java | 6 +++++- 1 file changed, 5 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 007d183cd57b14..48886c0773ea76 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 @@ -229,7 +229,11 @@ public Void visitLogicalProject(LogicalProject project, Statemen replaceSlotNamePath.addAll(outerPath.subList(1, outerPath.size())); allSlotToAccessPaths.put( innerSlot.getExprId().asInt(), - new CollectAccessPathResult(replaceSlotNamePath, outerSlotAccessPath.isPredicate(), outerSlotAccessPath.getType()) + new CollectAccessPathResult( + replaceSlotNamePath, + outerSlotAccessPath.isPredicate(), + outerSlotAccessPath.getType() + ) ); } } else {