seawinde commented on code in PR #66370:
URL: https://github.com/apache/doris/pull/66370#discussion_r3809752859
##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -605,6 +605,9 @@ public void queryRetry(TUniqueId queryId) throws Exception {
}
for (int i = 1; i <= retryTime; i++) {
try {
+ if (i > 1) {
+
statementContext.resetMaterializedViewStateForPlanningAttempt();
Review Comment:
Fixed in 2481a84b189. Proxy lazy parsing now adopts the StatementContext
owned by the parsed LogicalPlanAdapter through setStatementContext,
synchronizing the executor and ConnectContext before planning and retries. The
test performs a real proxy-style lazy parse, triggers an E-230 queryRetry, and
verifies that the authoritative MV state is cleared. The focused FE suite
passed 51/51.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java:
##########
@@ -91,6 +91,9 @@ public void run(ConnectContext ctx, StmtExecutor executor)
throws Exception {
}
PrepareCommand prepareCommand = preparedStmtCtx.command;
StatementContext statementContext =
preparedStmtCtx.getStatementContext();
+ // Prepared statements reuse StatementContext across executions.
Discard partition and MV
+ // planning results collected by the previous execution before
planning the current one.
+ statementContext.resetMaterializedViewStateForPreparedExecution();
Review Comment:
Current head 2481a84b189 keeps this fixed: queryRetry resets the existing
MV-only planning-attempt state before every retry, and InsertIntoTableCommand
resets it at the start of every planning iteration. The focused FE suite passed
51/51.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java:
##########
@@ -263,6 +263,9 @@ public AbstractInsertExecutor initPlan(ConnectContext ctx,
StmtExecutor stmtExec
// Each internal attempt must repin connector metadata; retaining
the previous writer schema can
// plan defaults and partition fields against the table version
that triggered the retry.
ctx.getStatementContext().resetConnectorStatementScope();
+ if (retryTimes > 1) {
Review Comment:
Fixed in 2481a84b189. InsertIntoTableCommand now resets the existing MV-only
planning-attempt state at the start of every initPlan iteration, including
first entry. This covers streaming preflight followed by task planning on the
same StatementContext without adding a streaming-specific branch. The test
executes two initPlan calls with needBeginTransaction=false and verifies stale
MV state is absent before the second target resolution. The focused FE suite
passed 51/51.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]