github-actions[bot] commented on code in PR #68648:
URL: https://github.com/apache/doris/pull/68648#discussion_r4236048954
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java:
##########
@@ -1608,9 +1608,11 @@ public Map<String, Map<MTMVRelatedTableIf, Set<String>>>
calculatePartitionMappi
Map<PartitionKeyDesc, Map<MTMVRelatedTableIf, Set<String>>>
pctPartitionDescs = MTMVPartitionUtil
.generateRelatedPartitionDescs(mvPartitionInfo, mvProperties,
getPartitionColumns(),
effectiveFilter, pinnedSnapshots);
+ Map<MTMVRelatedTableIf, String> defaultListPartitions =
defaultListPartitionsOf();
for (Entry<String, PartitionItem> entry : mvPartitionItems.entrySet())
{
- res.put(entry.getKey(),
-
pctPartitionDescs.getOrDefault(entry.getValue().toPartitionKeyDesc(),
Maps.newHashMap()));
+ res.put(entry.getKey(), withDefaultListPartitions(
+
pctPartitionDescs.getOrDefault(entry.getValue().toPartitionKeyDesc(),
Maps.newHashMap()),
Review Comment:
[P1] Reject an unmatched MV descriptor before adding default LIST
dependencies. In a two-PCT join, A has `LIST(d,k)` p1=((1,1)), and B has a
default partition holding d=1, so MV partition `{1}` contains committed rows.
If A adds p12=((1,2),(2,2)) after alignment releases its locks but before this
mapping, the desired merged descriptor becomes `{1,2}` and old `{1}` has no
direct match. This fanout nevertheless supplies B.default, making
`requireDescribedPartitions` pass. A has an empty mapped set, so its refresh
scan gets `FALSE` and COMPLETE overwrites populated `{1}` with no rows. Check
the direct descriptor match before fanout and retry alignment on a miss. This
is distinct from the existing no-default empty-map thread at
`UpdateMvByPartitionCommand.java:199`.
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java:
##########
@@ -166,25 +231,46 @@ 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) {
+ // A partition the query reads that no MV partition is
mapped from -- one the partition
+ // mapping left out, an expired base partition for
instance -- is one the MV's rows say
+ // nothing about. With the union rewrite on it is taken
out of the MV plan and read from
+ // the base table, so the MV partitions the other base
partitions map to still answer the
+ // query and this one is passed over. Without it the MV
alone would answer, so no partition
+ // is answered for at all: the MV is not a candidate for
this query and the query is
+ // answered from the base table.
+ if (unionRewrite) {
Review Comment:
[P1] Keep uncovered PCT tables visible to union compensation. In a two-PCT
join, A and B each have `LIST(d,k)` p_kept=((2020-01-01,1),(2038-01-01,1)); B
also has p_old=((2020-01-01,2)). A `2 YEAR` sync limit retains each p_kept
through its 2038 key but excludes B.p_old. Refresh the joined MV partition, set
`grace_period > 0`, and query A.p_kept joined to B.p_old while the MV is in
grace. The base plan `Join(Scan A[p_kept], Scan B[p_old])` has a committed k=2
row. This union-enabled skip still selects the MV partition through A;
query-used filtering then removes B entirely from the compensation mapping.
`PartitionCompensator` visits only A and produces no base union, so the MV-only
plan drops that row. Preserve B.p_old for compensation or reject this MV
candidate. The existing uncovered-partition thread covers union disabled, not
this two-PCT union 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]