yujun777 commented on code in PR #68648:
URL: https://github.com/apache/doris/pull/68648#discussion_r4144427900
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java:
##########
@@ -166,25 +166,35 @@ private static Set<String>
getMtmvPartitionsByRelatedPartitions(MTMV mtmv, MTMVR
}
Set<String> pctPartitions = entry.getValue();
for (String pctPartition : pctPartitions) {
- String mvPartition = relatedToMv.get(Pair.of(tableIf,
pctPartition));
- if (mvPartition != null) {
- res.add(mvPartition);
+ Set<String> mvPartitions = relatedToMv.get(Pair.of(tableIf,
pctPartition));
+ if (mvPartitions != null) {
Review Comment:
Fixed in a13f2939f3a, on the coverage side: a base partition the query reads
that no MV partition is mapped from now answers with no MV partition at all, so
the MV is not a candidate for that query and it is answered from the base
table. That is the direction that cannot drop rows; the alternative, forcing
base compensation, would need the coverage fact to reach `PartitionCompensator`
for a query whose MV partitions are not all invalid, which is a larger change
than this one.
Two things worth recording about it. The check sits where the MV-only
eligibility is decided (`getMTMVCanRewritePartitions` ->
`getMtmvPartitionsByRelatedPartitions`), which `PartitionCompensator` also
reads for the partitions it considers valid; answering "none" therefore takes
the union path out for that query as well, which costs the rewrite rather than
the answer. And, as with the two compensation threads, I could not build a
local case that reaches the branch: the shape needs an MV that is partly
usable, and this build's `checkMaterializationPattern` refuses one (`View
struct info is invalid`), so what I ran is the rewrite suites -- they are
green, which says the covered case still rewrites -- rather than the uncovered
case itself.
--
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]