This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 44de71047ea [fix](prune nested column) fix prune nested column maybe
throw NullPointerException (#60395)
44de71047ea is described below
commit 44de71047eadc8c4447ad8d9a898783978d2b1e5
Author: 924060929 <[email protected]>
AuthorDate: Mon Feb 2 19:08:36 2026 +0800
[fix](prune nested column) fix prune nested column maybe throw
NullPointerException (#60395)
fix prune nested column maybe throw NullPointerException, introduced by
#58370
```sql
select k1 as k2 -- can not find s.k2, we should replace k2 to k1
from
(
select struct_element(s, 'k1') k1
from tbl
)t
```
```
java.lang.NullPointerException: Cannot invoke
"org.apache.doris.nereids.rules.rewrite.NestedColumnPruning$DataTypeAccessTree.setAccessByPath(java.util.List,
int, org.apache.doris.thrift.TAccessPathType)" because the return value of
"java.util.Map.get(Object)" is null
at
org.apache.doris.nereids.rules.rewrite.NestedColumnPruning$DataTypeAccessTree.setAccessByPath(NestedColumnPruning.java:431)
at
org.apache.doris.nereids.rules.rewrite.NestedColumnPruning.pruneDataType(NestedColumnPruning.java:128)
at
org.apache.doris.nereids.rules.rewrite.NestedColumnPruning.rewriteRoot(NestedColumnPruning.java:86)
at
org.apache.doris.nereids.jobs.rewrite.CustomRewriteJob.execute(CustomRewriteJob.java:61)
at
org.apache.doris.nereids.jobs.executor.AbstractBatchJobExecutor.execute(AbstractBatchJobExecutor.java:167)
at
org.apache.doris.nereids.jobs.executor.Rewriter.lambda$execute$23(Rewriter.java:963)
at
org.apache.doris.nereids.util.MoreFieldsThread.keepFunctionSignature(MoreFieldsThread.java:127)
at
org.apache.doris.nereids.util.MoreFieldsThread.keepFunctionSignature(MoreFieldsThread.java:116)
at
org.apache.doris.nereids.jobs.executor.Rewriter.execute(Rewriter.java:962)
at
org.apache.doris.nereids.NereidsPlanner.lambda$rewrite$5(NereidsPlanner.java:434)
at
org.apache.doris.nereids.NereidsPlanner.keepOrShowPlanProcess(NereidsPlanner.java:1109)
at
org.apache.doris.nereids.NereidsPlanner.rewrite(NereidsPlanner.java:433)
at
org.apache.doris.nereids.NereidsPlanner.planWithoutLock(NereidsPlanner.java:297)
at
org.apache.doris.nereids.NereidsPlanner.planWithLock(NereidsPlanner.java:263)
at
org.apache.doris.nereids.NereidsPlanner.plan(NereidsPlanner.java:162)
at
org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:748)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:541)
at
org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:500)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:485)
at
org.apache.doris.qe.ConnectProcessor.executeQuery(ConnectProcessor.java:311)
at
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:198)
at
org.apache.doris.qe.MysqlConnectProcessor.handleQuery(MysqlConnectProcessor.java:231)
at
org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:259)
at
org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:403)
at
org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
```
---
.../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]