seawinde commented on code in PR #66370:
URL: https://github.com/apache/doris/pull/66370#discussion_r3710092678


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java:
##########
@@ -91,6 +91,10 @@ 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

Review Comment:
   Fixed the MV-related part in b959429e41c. 
`StatementContext.resetMaterializedViewStateForPreparedExecution()` is called 
once at the external `EXECUTE` boundary, resets 
`materializedViewRewriteDuration`, and removes stale `UseMvHint` instances 
while preserving unrelated hints. The test now invokes a real 
`NereidsPlanner.plan()` on both EXECUTEs.
   
   I intentionally did not clear `joinFilters`, `disableRules`, or 
`queryStatsRecorded` in this PR. They are independent 
prepared-`StatementContext` lifecycle concerns, not involved in the 
partition/MV root cause, and resetting them would change join-cost, 
session-rule, and query-statistics behavior without dedicated coverage. They 
should be handled separately rather than broadening this correctness fix.



-- 
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]

Reply via email to