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


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java:
##########
@@ -94,6 +111,18 @@ public static Collection<Partition> 
getMTMVCanRewritePartitions(MTMV mtmv, Conne
                     return res;
                 }
             }
+            if (mtmvNeedComparePartitions.isEmpty()) {
+                // A base partition the query reads is mapped from no MV 
partition of this one -- a partition
+                // the mapping left out, an expired one for instance -- so no 
MV partition holds its rows.
+                // None of them may answer this query, whatever the state of 
the partitions in grace below:
+                // the answer is the base table.
+                return Lists.newArrayList();
+            }
+            if (gracePeriodMills > 0 && currentTimeMills <= 
(partition.getVisibleVersionTime()
+                    + gracePeriodMills) && !forceConsistent) {

Review Comment:
   [P1] Do not grant grace to a newly aligned partition before its first 
refresh snapshot. For a LIST(d,k) base, let p12 contain ((1,1),(2,1)) and a 
committed d=1 row, then refresh a PARTITION BY d aggregate MV. Adding empty 
p23=((2,2),(3,2)) expands the projected component from {1,2} to {1,2,3}; 
alignment drops the populated MV partition and adds an empty one before 
refresh. This branch treats the new partition's creation timestamp as fresh and 
admits it without a refresh snapshot. Thus Aggregate(d,SUM(v)) -> 
Scan(base[p12,p23]) can rewrite to Scan(MV[empty {1,2,3}]) and omit the 
committed d=1 group while refresh runs or after it fails. The prior key-order 
thread concerned an unchanged key set; sorting cannot prevent this genuine 
expansion. Require a successful snapshot before grace can admit the replacement.



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