eskabetxe commented on code in PR #29420:
URL: https://github.com/apache/flink/pull/29420#discussion_r4790299150
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3FileSystem.java:
##########
@@ -306,17 +337,24 @@ public FSDataInputStream open(Path path, int bufferSize)
throws IOException {
checkNotClosed();
final String key = S3UriUtils.extractKey(path);
final S3Client s3Client = clientProvider.getS3Client();
- final long fileSize = getFileStatus(path).getLen();
- return new NativeS3InputStream(s3Client, bucketName, key, fileSize,
bufferSize);
+ return open(path, key, s3Client, bufferSize);
}
@Override
public FSDataInputStream open(Path path) throws IOException {
checkNotClosed();
final String key = S3UriUtils.extractKey(path);
final S3Client s3Client = clientProvider.getS3Client();
- final long fileSize = getFileStatus(path).getLen();
- return new NativeS3InputStream(s3Client, bucketName, key, fileSize,
readBufferSize);
+ return open(path, key, s3Client, readBufferSize);
+ }
+
+ private FSDataInputStream open(Path path, String key, S3Client s3Client,
int bufferSize)
+ throws IOException {
+ final FileStatus status = getFileStatus(path);
+ if (status.isDir()) {
Review Comment:
Limited the check to the bucket root as suggested, non-root prefixes keep
the pre-existing empty-stream behavior, and added
testOpenDirectoryPrefixReturnsEmptyStream pinning that.
--
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]