github-actions[bot] commented on code in PR #66473:
URL: https://github.com/apache/doris/pull/66473#discussion_r3781900519


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -202,6 +203,7 @@ public void run() throws JobException {
             Pair<Set<TableIf>, Set<TableIf>> tablesInPlan = 
MTMVPlanUtil.getBaseTableFromQuery(mtmv.getQuerySql(), ctx);
             this.relation = 
MTMVPlanUtil.generateMTMVRelation(tablesInPlan.first, tablesInPlan.second);
             beforeMTMVRefresh();
+            installTaskSnapshots(ctx.getStatementContext());

Review Comment:
   [P1] Attach a task statement context before installing snapshots
   
   `createMTMVContext()` returns a `ConnectContext` whose `statementContext` is 
still null. `getBaseTableFromQuery()` only installs a temporary context and 
restores that original null value, while `beforeMTMVRefresh()` fills 
`snapshots` for every `MvccTable` base (including HMS, Iceberg, and Paimon). 
This added call then passes null to `installTaskSnapshots()`, which 
dereferences it on the first entry, so an MTMV over any MVCC base fails before 
its refresh chunks run. The new helper test misses the production path because 
it manually assigns a task context first. Please create and attach the 
task-level `StatementContext` before analysis/snapshot installation, and cover 
the real `createMTMVContext()` initialization path.
   



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