Jackie-Jiang commented on a change in pull request #5587: URL: https://github.com/apache/incubator-pinot/pull/5587#discussion_r445223120
########## File path: pinot-minion/src/main/java/org/apache/pinot/minion/executor/MergeRollupTaskExecutor.java ########## @@ -0,0 +1,85 @@ +/** + * 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.minion.executor; + +import com.google.common.base.Preconditions; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.pinot.common.metadata.ZKMetadataProvider; +import org.apache.pinot.core.common.MinionConstants; +import org.apache.pinot.core.minion.PinotTaskConfig; +import org.apache.pinot.core.minion.rollup.MergeRollupSegmentConverter; +import org.apache.pinot.core.minion.rollup.MergeType; +import org.apache.pinot.spi.config.table.TableConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Task executor that provides merge and rollup service + * + * TODO: + * 1. Add the support for roll-up + * 2. Add the support for time split to provide backfill support for merged segments + * 3. Change the way to decide the number of output segments (explicit numPartition config -> maxRumRowsPerSegment) + */ +public class MergeRollupTaskExecutor extends BaseMultipleSegmentsConversionExecutor { + private static final Logger LOGGER = LoggerFactory.getLogger(MergeRollupTaskExecutor.class); + + @Override + protected List<SegmentConversionResult> convert(PinotTaskConfig pinotTaskConfig, List<File> originalIndexDirs, + File workingDir) throws Exception { + Map<String, String> configs = pinotTaskConfig.getConfigs(); + String mergeTypeString = configs.get(MinionConstants.MergeRollupTask.MERGE_TYPE_KEY); + // TODO: add the support for rollup + Preconditions.checkNotNull(mergeTypeString, "MergeType cannot be null"); + + MergeType mergeType = MergeType.fromString(mergeTypeString); + Preconditions.checkState(mergeType == MergeType.CONCATENATE, "Only 'CONCATENATE' mode is currently supported."); + + String mergedSegmentName = configs.get(MinionConstants.MergeRollupTask.MERGED_SEGMENT_NAME_KEY); + String tableNameWithType = configs.get(MinionConstants.TABLE_NAME_KEY); + + TableConfig tableConfig = + ZKMetadataProvider.getTableConfig(MINION_CONTEXT.getHelixPropertyStore(), tableNameWithType); + + MergeRollupSegmentConverter rollupSegmentConverter = + new MergeRollupSegmentConverter.Builder().setMergeType(mergeType) Review comment: Auto-reformat the file? ########## File path: pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/SegmentMergeCommand.java ########## @@ -194,9 +194,13 @@ public boolean execute() // TODO: add support for rollup String tableName = TableNameBuilder.extractRawTableName(tableConfig.getTableName()); MergeRollupSegmentConverter mergeRollupSegmentConverter = - new MergeRollupSegmentConverter.Builder().setMergeType(_mergeType).setSegmentName(_outputSegmentName) - .setInputIndexDirs(inputIndexDirs).setWorkingDir(workingDir).setTableName(tableName) - .setTableConfig(tableConfig).build(); + new MergeRollupSegmentConverter.Builder().setMergeType(MergeType.fromString(_mergeType)) Review comment: (nit) This does not comply with Pinot Style ########## File path: pinot-minion/src/main/java/org/apache/pinot/minion/executor/MergeRollupTaskExecutor.java ########## @@ -0,0 +1,85 @@ +/** + * 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.minion.executor; + +import com.google.common.base.Preconditions; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.pinot.common.metadata.ZKMetadataProvider; +import org.apache.pinot.core.common.MinionConstants; +import org.apache.pinot.core.minion.PinotTaskConfig; +import org.apache.pinot.core.minion.rollup.MergeRollupSegmentConverter; +import org.apache.pinot.core.minion.rollup.MergeType; +import org.apache.pinot.spi.config.table.TableConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Task executor that provides merge and rollup service + * + * TODO: + * 1. Add the support for roll-up + * 2. Add the support for time split to provide backfill support for merged segments + * 3. Change the way to decide the number of output segments (explicit numPartition config -> maxRumRowsPerSegment) Review comment: (nit) `maxNumRowsPerSegment` ########## File path: pinot-core/src/main/java/org/apache/pinot/core/minion/SegmentConverter.java ########## @@ -121,9 +119,10 @@ public SegmentConverter(List<File> inputIndexDirs, File workingDir, String table } // Sorting on sorted column and creating indices - if (_indexingConfig != null) { - List<String> sortedColumn = _indexingConfig.getSortedColumn(); - List<String> invertedIndexColumns = _indexingConfig.getInvertedIndexColumns(); + if (_tableConfig != null) { Review comment: Table config cannot be null, and we can remove this check ---------------------------------------------------------------- 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: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
