tibrewalpratik17 commented on code in PR #14340:
URL: https://github.com/apache/pinot/pull/14340#discussion_r1832443944


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskGenerator.java:
##########
@@ -304,4 +304,48 @@ static boolean validate(TableConfig tableConfig) {
     }
     return true;
   }
+
+  @Override
+  public void validateTaskConfigs(TableConfig tableConfig, Map<String, String> 
taskConfigs) {
+    // check table is realtime
+    Preconditions.checkState(tableConfig.getTableType() == TableType.REALTIME,
+        "UpsertCompactionTask only supports realtime tables!");
+    // check upsert enabled
+    Preconditions.checkState(tableConfig.isUpsertEnabled(), "Upsert must be 
enabled for UpsertCompactionTask");
+
+    // check no malformed period
+    if (taskConfigs.containsKey("bufferTimePeriod")) {
+      TimeUtils.convertPeriodToMillis(taskConfigs.get("bufferTimePeriod"));
+    }
+    // check invalidRecordsThresholdPercent
+    if (taskConfigs.containsKey("invalidRecordsThresholdPercent")) {
+      
Preconditions.checkState(Double.parseDouble(taskConfigs.get("invalidRecordsThresholdPercent"))
 >= 0
+              && 
Double.parseDouble(taskConfigs.get("invalidRecordsThresholdPercent")) <= 100,
+          "invalidRecordsThresholdPercent must be >= 0 and <= 100");
+    }
+    // check invalidRecordsThresholdCount
+    if (taskConfigs.containsKey("invalidRecordsThresholdCount")) {
+      
Preconditions.checkState(Long.parseLong(taskConfigs.get("invalidRecordsThresholdCount"))
 >= 1,
+          "invalidRecordsThresholdCount must be >= 1");
+    }
+    // check that either invalidRecordsThresholdPercent or 
invalidRecordsThresholdCount was provided
+    Preconditions.checkState(
+        taskConfigs.containsKey("invalidRecordsThresholdPercent") || 
taskConfigs.containsKey(

Review Comment:
   let's use MinionConstants variables here instead of hardcoding the names.



-- 
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...@pinot.apache.org

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


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

Reply via email to