siddharthteotia commented on a change in pull request #6625:
URL: https://github.com/apache/incubator-pinot/pull/6625#discussion_r591867775



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/recommender/rules/impl/RealtimeProvisioningRule.java
##########
@@ -0,0 +1,183 @@
+/**
+ * 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.recommender.rules.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import 
org.apache.pinot.controller.recommender.exceptions.InvalidInputException;
+import org.apache.pinot.controller.recommender.io.ConfigManager;
+import org.apache.pinot.controller.recommender.io.InputManager;
+import 
org.apache.pinot.controller.recommender.realtime.provisioning.MemoryEstimator;
+import org.apache.pinot.controller.recommender.rules.AbstractRule;
+import org.apache.pinot.controller.recommender.rules.io.configs.IndexConfig;
+import 
org.apache.pinot.controller.recommender.rules.io.params.RealtimeProvisioningRuleParams;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.utils.DataSizeUtils;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+
+
+/**
+ * This rule recommends gives some recommendations useful for provisioning 
real time tables. Specifically it provides
+ * some recommendations for optimal segments size, total memory used per host, 
and consuming memory used per host based
+ * on the provided characteristics of the data.
+ */
+public class RealtimeProvisioningRule extends AbstractRule {
+  public static String OPTIMAL_SEGMENT_SIZE = "Optimal Segment Size";
+  public static String CONSUMING_MEMORY_PER_HOST = "Consuming Memory per Host";
+  public static String TOTAL_MEMORY_USED_PER_HOST = "Total Memory Used per 
Host";
+
+  private final RealtimeProvisioningRuleParams _params;
+
+  public RealtimeProvisioningRule(InputManager input, ConfigManager output) {
+    super(input, output);
+    _params = input.getRealtimeProvisioningRuleParams();
+  }
+
+  @Override
+  public void run()
+      throws InvalidInputException {
+
+    if (_params == null) {

Review comment:
       Discussed this offline with @sajjad-moradi.
   
   Unlike params for other rules, RealtimeProvisioningRuleParams has 2 values 
(numReplicas and numKafkaPartitions) that do not have a default value and the 
user must provide them. Unless the user provides them, 
RealtimeProvisioningRuleParams will be null and so that will prevent this rule 
from being executed for offline tables assuming the user doesn't mess up and 
ends up providing the realtime rule input even for offline tables. 
   
   For now this approach is fine. I think later on as part of InputManager we 
can also capture the table type (offline/realtime/hybrid) and decide if a rule 
applicable only to realtime/hybrid should be invoked or not as opposed to 
relying on user doing the right thing. 




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

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