snleee commented on code in PR #9295: URL: https://github.com/apache/pinot/pull/9295#discussion_r964268229
########## pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/main/java/org/apache/pinot/plugin/ingestion/batch/common/BaseSegmentPushJobRunner.java: ########## @@ -0,0 +1,146 @@ +/** + * 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.plugin.ingestion.batch.common; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Map; +import org.apache.pinot.common.segment.generation.SegmentGenerationUtils; +import org.apache.pinot.segment.local.utils.ConsistentDataPushUtils; +import org.apache.pinot.segment.local.utils.SegmentPushUtils; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.env.PinotConfiguration; +import org.apache.pinot.spi.filesystem.PinotFS; +import org.apache.pinot.spi.filesystem.PinotFSFactory; +import org.apache.pinot.spi.ingestion.batch.runner.IngestionJobRunner; +import org.apache.pinot.spi.ingestion.batch.spec.PinotFSSpec; +import org.apache.pinot.spi.ingestion.batch.spec.SegmentGenerationJobSpec; + +public abstract class BaseSegmentPushJobRunner implements IngestionJobRunner { + + protected SegmentGenerationJobSpec _spec; + protected String[] _files; + protected PinotFS _outputDirFS; + protected URI _outputDirURI; + protected TableConfig _tableConfig; + protected boolean _consistentPushEnabled; + + /** + * Initialize BaseSegmentPushJobRunner with SegmentGenerationJobSpec + * Checks for required parameters in the spec and enablement of consistent data push. + */ + @Override + public void init(SegmentGenerationJobSpec spec) { + _spec = spec; + if (_spec.getPushJobSpec() == null) { + throw new RuntimeException("Missing PushJobSpec"); + } + + // Read Table spec + if (_spec.getTableSpec() == null) { + throw new RuntimeException("Missing tableSpec"); + } + + // Read Table config + if (_spec.getTableSpec().getTableConfigURI() == null) { + throw new RuntimeException("Missing property 'tableConfigURI' in 'tableSpec'"); + } + + _tableConfig = SegmentGenerationUtils.getTableConfig(_spec.getTableSpec().getTableConfigURI(), spec.getAuthToken()); + Review Comment: (nit) remove line ########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/SegmentPushUtils.java: ########## @@ -371,4 +372,35 @@ private static File generateSegmentMetadataFile(PinotFS fileSystem, URI tarFileU FileUtils.deleteQuietly(segmentMetadataDir); } } + + public static List<String> getSegmentNames(BatchConfigProperties.SegmentPushType pushMode, Review Comment: Why do we need to handle this separately for each `pushMode`? I thought `Map<String, String> segmentsUriToTarPathMap` should be in the same format regardless the pushMode. I thought that we can use the same code and put it to the Base class. Am I missing some detail here? -- 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: commits-unsubscr...@pinot.apache.org 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