Jackie-Jiang commented on a change in pull request #7222: URL: https://github.com/apache/pinot/pull/7222#discussion_r684697636
########## File path: pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/main/java/org/apache/pinot/plugin/ingestion/batch/common/SegmentGenerationJobUtils.java ########## @@ -43,4 +43,5 @@ public static boolean useGlobalDirectorySequenceId(SegmentNameGeneratorSpec spec } return Boolean.parseBoolean(useGlobalDirectorySequenceId); } + Review comment: (Code format) This empty line is added for several files within the change which is not needed. Can you please set up the code format following this doc: https://docs.pinot.apache.org/developers/developers-and-contributors/code-setup? ########## File path: pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGeneratorTest.java ########## @@ -0,0 +1,64 @@ +/** + * 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.segment.spi.creator.name; + +import java.net.URISyntaxException; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + + + +public class InputFileSegmentNameGeneratorTest { + private static final int INVALID_SEQUENCE_ID = -1; + + @Test + public void testWithInvalidPath() { + validateName("/my/path/to/segmentname.tsv", "my_path_to_segmentname_tsv"); + validateName("hdfs:///my/path/to/segmentname.tsv", "my_path_to_segmentname_tsv"); + } + + @Test + public void testWithHDFSPath() { + validateName("hdfs:///my/path/to/segmentname.csv", "segmentname"); + validateName("hdfs:/server:9000//my/path/to/segmentname.csv", "segmentname"); + } + + @Test + public void testWithFilePath() { + validateName("file:///my/path/to/segmentname.csv", "segmentname"); + } + + private void validateName(String inputFileUriAsStr, String segmentName) { + try { + String pattern = ".+/(.+)\\.csv"; Review comment: (Code format) indentation ########## File path: pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java ########## @@ -0,0 +1,91 @@ +/** + * 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.segment.spi.creator.name; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.annotation.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Segment name generator that supports defining the segment name based on the input file name + * and path, via a pattern (matched against the input file URI) and a template (currently only + * supports ${filePathPattern:\N}, where N is the group match number from the regex). + * + */ +@SuppressWarnings("serial") +public class InputFileSegmentNameGenerator implements SegmentNameGenerator { + + private static final Logger LOGGER = LoggerFactory Review comment: (Code format) Please reformat the file. The indentation is incorrect ########## File path: pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/test/java/org/apache/pinot/plugin/ingestion/batch/common/SegmentGenerationJobUtilsTest.java ########## @@ -48,4 +48,5 @@ public void testUseGlobalDirectorySequenceId() { spec.setConfigs(ImmutableMap.of("local.directory.sequence.id", "False")); Assert.assertTrue(SegmentGenerationJobUtils.useGlobalDirectorySequenceId(spec)); } + Review comment: Revert the unnecessary new line changes ########## File path: pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java ########## @@ -0,0 +1,91 @@ +/** + * 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.segment.spi.creator.name; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.annotation.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Segment name generator that supports defining the segment name based on the input file name + * and path, via a pattern (matched against the input file URI) and a template (currently only + * supports ${filePathPattern:\N}, where N is the group match number from the regex). + * + */ +@SuppressWarnings("serial") +public class InputFileSegmentNameGenerator implements SegmentNameGenerator { + + private static final Logger LOGGER = LoggerFactory + .getLogger(InputFileSegmentNameGenerator.class); + + private static final String PARAMETER_TEMPLATE = "${filePathPattern:\\%d}"; + + private Pattern filePathPattern; Review comment: (Code format) Prefix with underscore for the member variable and avoid using `this.` ########## File path: pinot-plugins/pinot-stream-ingestion/pinot-pulsar/pom.xml ########## @@ -58,6 +58,16 @@ <okio.version>1.6.0</okio.version> </properties> + <dependencyManagement> Review comment: Is this related? -- 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