Implement PrestoS3FileSystem#listFiles for direct recursive listings#15024
Merged
zhenxiao merged 1 commit intoprestodb:masterfrom Aug 21, 2020
Merged
Conversation
zhenxiao
requested changes
Aug 18, 2020
Collaborator
zhenxiao
left a comment
There was a problem hiding this comment.
thanks for looking at it, @pettyjamesm
left some comments :)
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
Outdated
Show resolved
Hide resolved
30eef37 to
cb4be32
Compare
zhenxiao
approved these changes
Aug 21, 2020
Collaborator
zhenxiao
left a comment
There was a problem hiding this comment.
nice work, @pettyjamesm
LGTM, only a few minor issues
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
Outdated
Show resolved
Hide resolved
Implements FileSystem#listFiles(Path, boolean recursive) for PrestoS3FileSystem which in theory adds support for directly listing S3 files underneath a prefix without recursive calls through each "directory". This direct traversal requires much fewer requests when dealing with nested directories but may violate some PathFilter implementation's expectation of being called at each directory level, and may perform worse when a large number objects are contained within hidden paths (since filtering would be performed after the fact). I'm open to suggestions about how to balance this trade-off and integrate this with the DirectoryLister. Incidentally, a straightforward improvement to getFileStatus fell out of the implementation allowing the isDir check for a path prefix (with no object present) to be done by limiting the listing result size to 1 instead of listing the full default 1000.
cb4be32 to
c108a13
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
FileSystem#listFiles(Path, boolean recursive)forPrestoS3FileSystemwhich in theory adds support for directly listing S3 files underneath a prefix without recursive calls through each "directory". This direct traversal requires much fewer requests when dealing with nested directories but may violate somePathFilterimplementation's expectation of being called at each directory level, and may perform worse when a large number objects are contained within hidden paths (since filtering would be performed after the fact). I'm open to suggestions about how to balance this trade-off and integrate this with the DirectoryLister.Incidentally, a straightforward improvement to getFileStatus fell out of the implementation allowing the isDir check for a path prefix (with no object present) to be done by limiting the listing result size to 1 instead of listing the full default 1000.