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



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/recommender/rules/impl/SegmentSizeRule.java
##########
@@ -0,0 +1,145 @@
+/**
+ * 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 com.google.common.annotations.VisibleForTesting;
+import java.io.File;
+import java.io.IOException;
+import org.apache.commons.io.FileUtils;
+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.SegmentSizeRecommendations;
+import 
org.apache.pinot.controller.recommender.rules.io.params.SegmentSizeRuleParams;
+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.builder.TableConfigBuilder;
+
+import static 
org.apache.pinot.controller.recommender.rules.io.params.RecommenderConstants.SegmentSizeRule.NOT_PROVIDED;
+
+
+/**
+ * This rule generates a segment based on the provided schema characteristics 
and then recommends the followings
+ * using the size and number of records in the generated segments:
+ *   - number of segments
+ *   - number of records in each segment
+ *   - size of each segment
+ * The purpose of generating a segment is to estimate the size and number of 
rows of one sample segment. In case user
+ * already have a production segment in hand, they can provide 
actualSegmentSize and numRowsInActualSegment parameters
+ * in the input and then this rule uses those parameters instead of generating 
a segment to derived those values.
+ */
+public class SegmentSizeRule extends AbstractRule {
+
+  static final int MEGA_BYTE = 1024 * 1024;
+
+  public SegmentSizeRule(InputManager input, ConfigManager output) {
+    super(input, output);
+  }
+
+  @Override
+  public void run()
+      throws InvalidInputException {
+
+    if (_input.getTableType().equalsIgnoreCase("REALTIME")) {
+      // no need to estimate segment size & optimal number of segments for 
realtime only tables;
+      // RT Provisioning Rule will have a comprehensive analysis on that

Review comment:
       Agreed as per our offline discussion. 




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