morrySnow commented on code in PR #28566:
URL: https://github.com/apache/doris/pull/28566#discussion_r1429988841


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -62,7 +66,7 @@
 
 public class MTMVTask extends AbstractTask {
     private static final Logger LOG = LogManager.getLogger(MTMVTask.class);
-    public static final Long MAX_HISTORY_TASKS_NUM = 100L;
+    public static final Integer DEFAULT_REFRESH_PARTITION_NUM = 1;

Review Comment:
   why Integer?



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java:
##########
@@ -185,6 +185,15 @@ public long getGracePeriod() {
         }
     }
 
+    public int getRefreshPartitionNum() {
+        if 
(mvProperties.containsKey(PropertyAnalyzer.PROPERTIES_REFRESH_PARTITION_NUM)) {
+            int value = 
Integer.parseInt(mvProperties.get(PropertyAnalyzer.PROPERTIES_REFRESH_PARTITION_NUM));
+            return value < 1 ? 1 : value;

Review Comment:
   Math.max(1, value);



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java:
##########
@@ -235,7 +247,7 @@ private void analyzePartition(NereidsPlanner planner) {
                 throw new AnalysisException(e.getMessage(), e);
             }
 
-            if 
(!partitionColumnNames.contains(relatedTableInfo.get().getColumn())) {
+            if 
(!partitionColumnNames.contains(relatedTableInfo.get().getColumn().toLowerCase()))
 {

Review Comment:
   maybe could use case insensitive set?



##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -97,7 +103,7 @@ public enum MTMVTaskTriggerMode {
 
     public enum MTMVTaskRefreshMode {
         COMPLETE,
-        PARTITION,
+        PARTIAL,

Review Comment:
   why change to partial? how to distingush beteen partition refresh and binlog 
data refresh if we named partition refrash as partial?



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java:
##########
@@ -185,6 +185,15 @@ public long getGracePeriod() {
         }
     }
 
+    public int getRefreshPartitionNum() {
+        if 
(mvProperties.containsKey(PropertyAnalyzer.PROPERTIES_REFRESH_PARTITION_NUM)) {
+            int value = 
Integer.parseInt(mvProperties.get(PropertyAnalyzer.PROPERTIES_REFRESH_PARTITION_NUM));
+            return value < 1 ? 1 : value;

Review Comment:
   use MTMVTask.DEFAULT_REFRESH_PARTITION_NUM instead of 1?



##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -214,10 +242,35 @@ public TRow getTvfInfo() {
                 new TCell().setStringVal(refreshMode == null ? 
FeConstants.null_string : refreshMode.toString()));
         trow.addToColumnValue(
                 new TCell().setStringVal(
-                        refreshPartitions == null ? FeConstants.null_string : 
new Gson().toJson(refreshPartitions)));
+                        needRefreshPartitions == null ? 
FeConstants.null_string : new Gson().toJson(
+                                needRefreshPartitions)));
+        trow.addToColumnValue(
+                new TCell().setStringVal(
+                        completedPartitions == null ? FeConstants.null_string 
: new Gson().toJson(
+                                completedPartitions)));
+        trow.addToColumnValue(
+                new TCell().setStringVal(getProgress()));
         return trow;
     }
 
+    private String getProgress() {
+        if (CollectionUtils.isEmpty(needRefreshPartitions)) {
+            return FeConstants.null_string;
+        }
+        int completedSize = CollectionUtils.isEmpty(completedPartitions) ? 0 : 
completedPartitions.size();
+        BigDecimal result = new BigDecimal(completedSize * 100)
+                .divide(new BigDecimal(needRefreshPartitions.size()), 2, 
RoundingMode.HALF_UP);
+        StringBuilder builder = new StringBuilder(result.toString());
+        builder.append("%");
+        builder.append(" ");
+        builder.append("(");

Review Comment:
   why not append once?



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to