Jackie-Jiang commented on a change in pull request #5897:
URL: https://github.com/apache/incubator-pinot/pull/5897#discussion_r472553793



##########
File path: 
pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/test/java/org/apache/pinot/plugin/ingestion/batch/common/TestSegmentPushUtils.java
##########
@@ -0,0 +1,79 @@
+/**
+ * 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.net.URI;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class TestSegmentPushUtils {

Review comment:
       Rename it to `SegmentPushUtilsTest`

##########
File path: 
pinot-plugins/pinot-file-system/pinot-s3/src/test/java/org/apache/pinot/plugin/filesystem/S3PinotFSTest.java
##########
@@ -287,7 +287,7 @@ public void testCopyFromAndToLocal()
 
     Assert.assertEquals(headObjectResponse.contentLength(), (Long) 
fileToCopy.length());
 
-    File fileToDownload = new File("copyFile_download.txt");
+    File fileToDownload = new File("copyFile_download.txt").getAbsoluteFile();

Review comment:
       Why do we change this in the test? This should be handled within the 
`PinotFS`

##########
File path: 
pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/main/java/org/apache/pinot/plugin/ingestion/batch/common/SegmentPushUtils.java
##########
@@ -46,6 +47,27 @@
 
   private static final FileUploadDownloadClient FILE_UPLOAD_DOWNLOAD_CLIENT = 
new FileUploadDownloadClient();
 
+  public static URI generateSegmentTarURI(URI outputDirURI, URI fileURI, 
String prefix, String suffix) {
+    if (StringUtils.isEmpty(prefix) && StringUtils.isEmpty(suffix)) {
+      // In case the FS doesn't provide scheme or host, will fill it up from 
outputDirURI.
+      String scheme = fileURI.getScheme();
+      if (StringUtils.isEmpty(fileURI.getScheme())) {
+        scheme = outputDirURI.getScheme();
+      }
+      String host = fileURI.getHost();
+      if (StringUtils.isEmpty(fileURI.getHost())) {
+        host = outputDirURI.getHost();
+      }
+      try {
+        return new URI(scheme, fileURI.getUserInfo(), host, fileURI.getPort(), 
fileURI.getPath(), fileURI.getQuery(),
+            fileURI.getFragment());
+      } catch (URISyntaxException e) {
+        return fileURI;

Review comment:
       Log something here for debugging purpose?

##########
File path: 
pinot-plugins/pinot-file-system/pinot-s3/src/main/java/org/apache/pinot/plugin/filesystem/S3PinotFS.java
##########
@@ -411,6 +412,7 @@ public void copyToLocalFile(URI srcUri, File dstFile)
       throws Exception {
     LOGGER.info("Copy {} to local {}", srcUri, dstFile.getAbsolutePath());
     URI base = getBase(srcUri);
+    FileUtils.forceMkdir(dstFile.getParentFile());

Review comment:
       Should we handle this in the `PinotFS`?




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