github-actions[bot] commented on code in PR #66370:
URL: https://github.com/apache/doris/pull/66370#discussion_r3793569129
##########
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:
**[P1] Reset MV state before the first plan on a reused insert context**
This guard only clears later iterations inside one `initPlan` call.
`StreamingInsertTask.before()` first runs `baseCommand.initPlan(..., false)`,
rewrites the TVF offset, and `run()` then plans `taskCommand` with the same
`StatementContext`; both calls start at retry 1. A streaming INSERT may join
its one TVF to an MV-eligible catalog table, and
`session.pre_materialized_view_rewrite_strategy=FORCE_IN_RBO` makes the pre-RBO
path deterministic. The second call appends to the preflight
`tmpPlanForMvRewrite`, so `preMaterializedViewRewrite()`/`toMemo()` can import
an alternative retaining the preflight S3 URI or original CDC configuration
without the current task identity. Selecting it can rescan or skip source data.
Reset attempt-produced MV state on the first entry too, or explicitly between
streaming preflight and task planning, and cover this two-call lifecycle in a
test.
--
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]