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


##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/TaskConfigUtils.java:
##########
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.controller.util;
+
+import java.util.Map;
+import org.apache.pinot.controller.helix.core.minion.PinotTaskManager;
+import 
org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import 
org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorRegistry;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class TaskConfigUtils {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(TaskConfigUtils.class);
+
+  private TaskConfigUtils() {
+  }
+
+  public static void validateTaskConfigs(TableConfig tableConfig, 
PinotTaskManager pinotTaskManager) {
+    if (tableConfig == null || tableConfig.getTaskConfig() == null) {
+      return;
+    }
+    TableTaskConfig taskConfig = tableConfig.getTaskConfig();
+    for (Map.Entry<String, Map<String, String>> taskConfigEntry : 
taskConfig.getTaskTypeConfigsMap().entrySet()) {
+      String taskType = taskConfigEntry.getKey();
+      TaskGeneratorRegistry taskRegistry = 
pinotTaskManager.getTaskGeneratorRegistry();
+      if (taskRegistry != null) {
+        PinotTaskGenerator taskGenerator = 
taskRegistry.getTaskGenerator(taskType);
+        if (taskGenerator != null) {
+          taskGenerator.validateTaskConfigs(tableConfig);
+        } else {
+          LOGGER.warn("Task generator not found for task type: {}, while 
validating table configs for table: {}",

Review Comment:
   This is actually a wrong config? Probably validated elsewhere, if not we can 
do here itself. No generator for taskType. 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/TaskConfigUtils.java:
##########
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.controller.util;
+
+import java.util.Map;
+import org.apache.pinot.controller.helix.core.minion.PinotTaskManager;
+import 
org.apache.pinot.controller.helix.core.minion.generator.PinotTaskGenerator;
+import 
org.apache.pinot.controller.helix.core.minion.generator.TaskGeneratorRegistry;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class TaskConfigUtils {

Review Comment:
   Dont we want to consolidate the already existing one as well here?  This 
method can call the individual generator's validation function, when it 
iterates over task config map.
   
   
     @VisibleForTesting
     static void validateTaskConfigs(TableConfig tableConfig, Schema schema) {
       TableTaskConfig taskConfig = tableConfig.getTaskConfig();
       if (taskConfig != null) {
         for (Map.Entry<String, Map<String, String>> taskConfigEntry : 
taskConfig.getTaskTypeConfig
   



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