This is an automated email from the ASF dual-hosted git repository.
HonestManXin 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 058b065e3ae [fix](prepare) Avoid prepared statement retry NPE (#68574)
058b065e3ae is described below
commit 058b065e3ae2385f4163cac9f0a91cb0dbe8b735
Author: HonestManXin <[email protected]>
AuthorDate: Tue Oct 13 17:45:00 2026 +0800
[fix](prepare) Avoid prepared statement retry NPE (#68574)
During prepared statement execution, ExecuteCommand creates a new
LogicalPlanAdapter and replaces the original parsedStmt in StmtExecutor.
Because LogicalPlanAdapter does not initialize originStmt in its
constructor, the new statement may have a null originStmt. If the query
encounters a retryable exception, the retry log dereferences
parsedStmt.getOrigStmt().originStmt, causing a NullPointerException that
masks the original error and interrupts the retry process.
---
.../org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java | 1 -
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java
index ee09d2a7d1a..f7f129e23cf 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java
@@ -251,7 +251,6 @@ public class ExecuteCommand extends Command {
}
reparsedStatementContext.setPlaceholders(refreshedPlaceholders);
- reparsedAdapter.setOrigStmt(currentCommand.getOriginalStmt());
executor.setStatementContext(reparsedStatementContext);
executor.setParsedStmt(reparsedAdapter);
PrepareCommand refreshedCommand = new
PrepareCommand(currentCommand.getName(),
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 391f52495dd..c0f9fad616a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -1359,11 +1359,11 @@ public class StmtExecutor {
// the plan would read nothing, or only what the failed
attempt left, and succeed.
LOG.warn("not retrying query {} with the same plan: a scan
node's ranges cannot be read"
+ " again by the backend. stmt: {}",
- DebugUtil.printId(context.queryId()),
parsedStmt.getOrigStmt().originStmt);
+ DebugUtil.printId(context.queryId()),
originStmt.originStmt);
throw e;
}
if (i != retryTime - 1 && isNeedRetry &&
context.getProtocolAdapter().canRetryQuery(context)) {
- LOG.warn("retry {} times. stmt: {}", (i + 1),
parsedStmt.getOrigStmt().originStmt);
+ LOG.warn("retry {} times. stmt: {}", (i + 1),
originStmt.originStmt);
willRetry = true;
} else {
throw e;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]