abstractdog commented on a change in pull request #3031:
URL: https://github.com/apache/hive/pull/3031#discussion_r809901168



##########
File path: common/src/java/org/apache/hadoop/hive/common/FileUtils.java
##########
@@ -361,7 +361,7 @@ private static void listS3FilesRecursive(FileStatus base, 
FileSystem fs, List<Fi
     RemoteIterator<LocatedFileStatus> remoteIterator = 
fs.listFiles(base.getPath(), true);
     while (remoteIterator.hasNext()) {
       LocatedFileStatus each = remoteIterator.next();
-      Path relativePath = new 
Path(each.getPath().toString().replace(base.toString(), ""));
+      Path relativePath = new 
Path(each.getPath().toString().replaceFirst(base.getPath().toString(), ""));

Review comment:
       change makes sense
   some ideas:
   isn't 
[Path.relativize](https://www.geeksforgeeks.org/path-relativize-method-in-java-with-examples/)
 for the same purpose?
   a) is so could you please check its source if it does this optimized version 
or not worse (from performance POV)
   b) if it isn't, could you please refactor this to utility method here? in 
this case, please include unit test into TestFileUtils




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to