You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/10/05 20:38:41 UTC

[GitHub] [pinot] walterddr commented on a change in pull request #7523: add validation for realtimeToOffline task

walterddr commented on a change in pull request #7523:
URL: https://github.com/apache/pinot/pull/7523#discussion_r722667729



##########
File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
##########
@@ -303,17 +307,40 @@ public static void validateIngestionConfig(TableConfig tableConfig, @Nullable Sc
     }
   }
 
-  private static void validateTaskConfigs(TableConfig tableConfig) {
+  private static void validateTaskConfigs(TableConfig tableConfig, Schema schema) {
     TableTaskConfig taskConfig = tableConfig.getTaskConfig();
-    if (taskConfig != null && taskConfig.isTaskTypeEnabled(SEGMENT_GENERATION_AND_PUSH_TASK_TYPE)) {
-      Map<String, String> taskTypeConfig = taskConfig.getConfigsForTaskType(SEGMENT_GENERATION_AND_PUSH_TASK_TYPE);
-      if (taskTypeConfig != null && taskTypeConfig.containsKey(SCHEDULE_KEY)) {
-        String cronExprStr = taskTypeConfig.get(SCHEDULE_KEY);
-        try {
-          CronScheduleBuilder.cronSchedule(cronExprStr);
-        } catch (Exception e) {
-          throw new IllegalStateException(
-              String.format("SegmentGenerationAndPushTask contains an invalid cron schedule: %s", cronExprStr), e);
+    // TODO validate task config directly from PinotTaskGenerator API
+    if (taskConfig != null) {
+      if (taskConfig.isTaskTypeEnabled(SEGMENT_GENERATION_AND_PUSH_TASK_TYPE)) {
+        Map<String, String> taskTypeConfig = taskConfig.getConfigsForTaskType(SEGMENT_GENERATION_AND_PUSH_TASK_TYPE);
+        if (taskTypeConfig != null && taskTypeConfig.containsKey(SCHEDULE_KEY)) {
+          String cronExprStr = taskTypeConfig.get(SCHEDULE_KEY);
+          try {
+            CronScheduleBuilder.cronSchedule(cronExprStr);
+          } catch (Exception e) {
+            throw new IllegalStateException(String.format(
+                "SegmentGenerationAndPushTask contains an invalid cron schedule: %s", cronExprStr), e);
+          }
+        }
+      }
+      if (taskConfig.isTaskTypeEnabled(REALTIME_TO_OFFLINE_TASK_TYPE)) {
+        Map<String, String> taskTypeConfig = taskConfig.getConfigsForTaskType(REALTIME_TO_OFFLINE_TASK_TYPE);
+        if (taskTypeConfig != null) {

Review comment:
       no introduced by this PR either but will fix. Also would add some test before merging. 




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

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



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