This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new ebc1afed4af [enhance](mtmv)when calculating the availability of MTMV, 
no longer c… (#36617)
ebc1afed4af is described below

commit ebc1afed4afcf42153ce8f6593b1ff6466c8d95a
Author: zhangdong <493738...@qq.com>
AuthorDate: Tue Jul 2 14:24:33 2024 +0800

    [enhance](mtmv)when calculating the availability of MTMV, no longer c… 
(#36617)
    
    pick: #36507
---
 .../main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java  |  4 ++--
 .../java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java   | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java 
b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java
index 03a1aefeba1..209fd5da0f6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java
@@ -62,8 +62,8 @@ public class MTMVRewriteUtil {
             return res;
         }
         // check mv is normal
-        if (!(mtmv.getStatus().getState() == MTMVState.NORMAL
-                && mtmv.getStatus().getRefreshState() == 
MTMVRefreshState.SUCCESS)) {
+        if (mtmv.getStatus().getState() != MTMVState.NORMAL
+                || mtmv.getStatus().getRefreshState() == 
MTMVRefreshState.INIT) {
             return res;
         }
         Map<String, Set<String>> partitionMappings = null;
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java
index 864478933c0..40797760b70 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java
@@ -256,7 +256,20 @@ public class MTMVRewriteUtilTest {
         };
         Collection<Partition> mtmvCanRewritePartitions = MTMVRewriteUtil
                 .getMTMVCanRewritePartitions(mtmv, ctx, currentTimeMills);
-        Assert.assertEquals(0, mtmvCanRewritePartitions.size());
+        Assert.assertEquals(1, mtmvCanRewritePartitions.size());
     }
 
+    @Test
+    public void testGetMTMVCanRewritePartitionsRefreshStateInit() {
+        new Expectations() {
+            {
+                status.getRefreshState();
+                minTimes = 0;
+                result = MTMVRefreshState.INIT;
+            }
+        };
+        Collection<Partition> mtmvCanRewritePartitions = MTMVRewriteUtil
+                .getMTMVCanRewritePartitions(mtmv, ctx, currentTimeMills);
+        Assert.assertEquals(0, mtmvCanRewritePartitions.size());
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to