github-actions[bot] commented on code in PR #68648:
URL: https://github.com/apache/doris/pull/68648#discussion_r4369982898
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/IvmFullRefreshMTMV.java:
##########
@@ -85,6 +86,14 @@ private Plan rewriteScan(LogicalOlapScan scan,
IvmRewriteContext rewriteContext)
}
Optional<Set<Long>> resetPartitionIds =
rewriteContext.getFullRefreshResetPartitionIds(baseTableInfo);
+ if (resetPartitionIds.isPresent() &&
resetPartitionIds.get().isEmpty()) {
+ // A PCT table this batch's mapping does not name is read as no
rows: the partitions it feeds
+ // the batch with are none, and its own ordinary scan would read
the ones the alignment no
+ // longer records -- the sync window dropped them, say -- so their
rows would enter the MV
+ // partition while the snapshot says the table was not read.
Answered here rather than as a
+ // stream scan with no partitions, so that a table read as nothing
needs no usable stream.
+ return new
LogicalEmptyRelation(StatementScopeIdGenerator.newRelationId(),
scan.getOutput());
Review Comment:
[P2] Carry empty IVM input scopes into COMPLETE EXPLAIN
The new empty-reset behavior is absent from `EXPLAIN REFRESH ... COMPLETE`.
Reuse `test_ivm_absent_pct_input_read_scope`: A/C form M={2020,2038,2039},
while the 2 YEAR window excludes B.old={2020}; `refresh_partition_num=1` makes
execution's M batch read B as empty here. EXPLAIN instead installs
`IvmRewriteContext.fullExplain(mtmv)`, which supplies neither reset IDs nor a
non-PCT read mode. Thus `hasFullRefreshStreamScans()` is false, this rule never
runs, and `RefreshMTMVCommand` also passes a null IVM predicate scope. The
reduced plans differ:
```text
execution M: Aggregate -> Join(RESET A[kept], Empty B, RESET C[kept])
EXPLAIN: Aggregate -> Join(Scan A, Scan B[old], Scan C)
```
The preview therefore shows a 2020 join contribution that COMPLETE
intentionally does not materialize, hiding the scope decision this change
introduces. Derive the explained IVM reads from the same batch mapping/reset
scopes and add an EXPLAIN assertion to that fixture. This is distinct from the
[fixed non-IVM predicate-scope
case](https://github.com/apache/doris/pull/68648#discussion_r4145157509): it
concerns the newly empty IVM reset input at this rule.
--
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]