wenzhenghu commented on code in PR #60559:
URL: https://github.com/apache/doris/pull/60559#discussion_r3410719068


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadSchedPolicyMgr.java:
##########
@@ -245,27 +246,36 @@ public void createWorkloadSchedPolicy(String policyName, 
boolean isIfNotExists,
         }
     }
 
-    private boolean checkPolicyCondition(List<WorkloadCondition> 
conditionList) throws UserException {
+    private Boolean checkPolicyCondition(List<WorkloadCondition> 
conditionList) throws UserException {
         if (conditionList.size() > 
Config.workload_max_condition_num_in_policy) {
             throw new UserException(
                     "condition num in a policy can not exceed " + 
Config.workload_max_condition_num_in_policy);
         }
-        boolean containsFeMetric = false;
-        boolean containsBeMetric = false;
+        boolean hasFeOnlyMetric = false;
+        boolean hasBeOnlyMetric = false;
         for (WorkloadCondition cond : conditionList) {
-            if (FE_METRIC_SET.contains(cond.getMetricType())) {
-                containsFeMetric = true;
-            }
-            if (BE_METRIC_SET.contains(cond.getMetricType())) {
-                containsBeMetric = true;
+            boolean isFe = FE_METRIC_SET.contains(cond.getMetricType());
+            boolean isBe = BE_METRIC_SET.contains(cond.getMetricType());
+
+            if (isFe && !isBe) {
+                hasFeOnlyMetric = true;
+            } else if (isBe && !isFe) {
+                hasBeOnlyMetric = true;
             }
-            if (containsFeMetric && containsBeMetric) {
+
+            if (hasFeOnlyMetric && hasBeOnlyMetric) {
                 throw new UserException(
-                        "one policy can not contains fe and be metric, FE 
metric list is " + FE_METRIC_SET
+                        "one policy can not contains fe only and be only 
metric, FE metric list is " + FE_METRIC_SET
                                 + ", BE metric list is " + BE_METRIC_SET);
             }
         }
-        return containsFeMetric;
+        if (hasFeOnlyMetric) {
+            return true;
+        } else if (hasBeOnlyMetric) {
+            return false;
+        } else {
+            return null;
+        }

Review Comment:
   it`s  all right



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