Jackie-Jiang commented on a change in pull request #7523:
URL: https://github.com/apache/pinot/pull/7523#discussion_r722510986



##########
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)) 
{

Review comment:
       Not introduced in this PR, but `"schedule"` field applies to all the 
tasks, and we should check it for all the tasks by looping over the 
`taskConfig.getTaskTypeConfigsMap()`

##########
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:
       The `null` check is redundant




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