yujun777 commented on code in PR #68648:
URL: https://github.com/apache/doris/pull/68648#discussion_r4370053086
##########
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:
Fixed in \`493752e6e40\`.
\`collectPctResetPartitionIds\` moved out of \`MTMVTask\` into
\`MTMVPartitionUtil\`, and \`RefreshMTMVCommand\`'s COMPLETE branch now
installs \`IvmRewriteContext.fullExplain(mtmv, resetIds,
StreamReadMode.RESET)\` built from the same \`MTMVRefreshContext\` mapping
execution uses. A PCT input the mapping does not name carries an explicit empty
reset set, so the preview reads it as no rows, exactly as the batch executor
does.
One nuance: COMPLETE EXPLAIN covers every MV partition in one plan, so its
scope is the union over them, not the M batch alone. B is therefore previewed
as \`partitions=1/3 (b_shared)\` -- still read for the 2045 component, not
empty as in the M batch -- but the 2020 contribution from \`b_old\` your
reduced plan shows is gone. The fixture now asserts this: \`contains
"partitions=1/3 (b_shared)"\` and \`notContains "b_old"\`.
Regression: test_ivm_absent_pct_input_read_scope, test_ivm_explain_refresh,
test_ivm_agg_previous_commit_not_visible, test_ivm_use_full_keys_4 all pass.
##########
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:
Fixed in `493752e6e40`.
`collectPctResetPartitionIds` moved out of `MTMVTask` into
`MTMVPartitionUtil`, and `RefreshMTMVCommand`'s COMPLETE branch now installs
`IvmRewriteContext.fullExplain(mtmv, resetIds, StreamReadMode.RESET)` built
from the same `MTMVRefreshContext` mapping execution uses. A PCT input the
mapping does not name carries an explicit empty reset set, so the preview reads
it as no rows, exactly as the batch executor does.
One nuance: COMPLETE EXPLAIN covers every MV partition in one plan, so its
scope is the union over them, not the M batch alone. B is therefore previewed
as `partitions=1/3 (b_shared)` -- still read for the 2045 component, not empty
as in the M batch -- but the 2020 contribution from `b_old` your reduced plan
shows is gone. The fixture now asserts this: `contains "partitions=1/3
(b_shared)"` and `notContains "b_old"`.
Regression: test_ivm_absent_pct_input_read_scope, test_ivm_explain_refresh,
test_ivm_agg_previous_commit_not_visible, test_ivm_use_full_keys_4 all pass.
--
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]