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


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/ivm/IvmRewriteContext.java:
##########
@@ -163,11 +163,19 @@ public static IvmRewriteContext incrementalDryRun(MTMV 
mtmv, Optional<IvmDryRunL
                 Collections.emptyMap());
     }
 
-    /** EXPLAIN REFRESH COMPLETE: only a plan is produced. */
+    /**
+     * EXPLAIN REFRESH COMPLETE: only a plan is produced, and it is the plan a 
whole-MV COMPLETE
+     * refresh runs. That refresh reads every base table it does not partition 
by with
+     * {@link StreamReadMode#RESET} (MTMVTask#executePartitionBasedRefresh 
picks the mode: RESET for
+     * the first batch of a whole-MV refresh, SNAPSHOT afterwards), so a 
context that left the mode
+     * empty would plan the normalized query over ordinary base scans -- a 
different plan from the
+     * one the refresh executes. A refresh split into batches continues with 
SNAPSHOT for the later
+     * ones, which one EXPLAIN statement cannot show.
+     */
     public static IvmRewriteContext fullExplain(MTMV mtmv) {
         return new IvmRewriteContext(Mode.FULL, Objects.requireNonNull(mtmv, 
"mtmv can not be null"),
-                null, false, ExecutionKind.EXPLAIN, Optional.empty(), 
Collections.emptyMap(), Optional.empty(),
-                Collections.emptyMap());
+                null, false, ExecutionKind.EXPLAIN, Optional.empty(), 
Collections.emptyMap(),
+                Optional.of(StreamReadMode.RESET), Collections.emptyMap());

Review Comment:
   [P2] Include PCT reset scopes in COMPLETE EXPLAIN. `fullExplain()` leaves 
`fullRefreshResetPartitionIds` empty, so `IvmFullRefreshMTMV` returns the 
ordinary scan for every PCT base table. The first whole-MV COMPLETE batch 
instead passes `collectPctResetPartitionIds(...)` and rewrites those mapped 
partitions through RESET stream scans. `EXPLAIN REFRESH ... COMPLETE` therefore 
still omits the PCT stream/reset path and misleads plan/debug/performance 
diagnosis for partitioned MVs. Carry the mapped reset scope into the explain 
context (or an equivalent stream representation) and add a PCT EXPLAIN 
regression case.



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