mcvsubbu commented on a change in pull request #6255: URL: https://github.com/apache/incubator-pinot/pull/6255#discussion_r530531433
########## File path: pinot-common/src/main/java/org/apache/pinot/common/config/tuner/TableConfigTunerRegistry.java ########## @@ -0,0 +1,97 @@ +/** + * 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.common.config.tuner; + +import com.google.common.base.Preconditions; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import org.apache.pinot.common.function.FunctionInfo; +import org.apache.pinot.common.function.FunctionInvoker; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.config.table.tuner.TableConfigTuner; +import org.apache.pinot.spi.data.Schema; +import org.reflections.Reflections; +import org.reflections.scanners.MethodAnnotationsScanner; +import org.reflections.util.ClasspathHelper; +import org.reflections.util.ConfigurationBuilder; +import org.reflections.util.FilterBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Helper class to dynamically register all annotated {@link TableConfigTuner} methods + */ +public class TableConfigTunerRegistry { + private static final int NUM_PARAMETERS = 2; + + private TableConfigTunerRegistry() { + } + + private static final Logger LOGGER = LoggerFactory.getLogger(TableConfigTunerRegistry.class); + private static final Map<String, FunctionInfo> tunerFunctionInfoMap = new HashMap<>(); + + static { + long startTimeMs = System.currentTimeMillis(); Review comment: Why are we measuring the time here? This should happen during startup, and should be fairly quick. ########## File path: pinot-common/src/main/java/org/apache/pinot/common/config/tuner/RealTimeAutoIndexTuner.java ########## @@ -0,0 +1,42 @@ +/** + * 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.common.config.tuner; + +import org.apache.pinot.spi.config.table.IndexingConfig; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.config.table.tuner.TableConfigTuner; +import org.apache.pinot.spi.data.Schema; + + +/** + * Used to auto-tune the table indexing config. It takes the original table + * config, table schema and adds the following to indexing config: + * - Inverted indices for all dimensions + * - No dictionary index for all metrics + */ +public class RealTimeAutoIndexTuner { + + @TableConfigTuner(name = "realtimeAutoIndexTuner") + public static TableConfig tuneTableConfig(TableConfig initialConfig, Schema schema) { + IndexingConfig initialIndexingConfig = initialConfig.getIndexingConfig(); Review comment: Should think of adding one column as sorted. I am not sure how to pick that column. ########## File path: pinot-common/src/main/java/org/apache/pinot/common/config/tuner/RealTimeAutoIndexTuner.java ########## @@ -0,0 +1,42 @@ +/** + * 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.common.config.tuner; + +import org.apache.pinot.spi.config.table.IndexingConfig; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.config.table.tuner.TableConfigTuner; +import org.apache.pinot.spi.data.Schema; + + +/** + * Used to auto-tune the table indexing config. It takes the original table + * config, table schema and adds the following to indexing config: + * - Inverted indices for all dimensions + * - No dictionary index for all metrics + */ +public class RealTimeAutoIndexTuner { + + @TableConfigTuner(name = "realtimeAutoIndexTuner") + public static TableConfig tuneTableConfig(TableConfig initialConfig, Schema schema) { Review comment: I suggest adding a check in (perhaps some base class?) if there are already some columns configured for inv index, no dictionary, etc. If so, then the configured items take precedence over what this method does. ---------------------------------------------------------------- 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