steveloughran commented on code in PR #1807:
URL: https://github.com/apache/avro/pull/1807#discussion_r1873518633
##########
lang/java/mapred/src/main/java/org/apache/avro/mapred/FsInput.java:
##########
@@ -40,8 +45,19 @@ public FsInput(Path path, Configuration conf) throws
IOException {
/** Construct given a path and a {@code FileSystem}. */
public FsInput(Path path, FileSystem fileSystem) throws IOException {
- this.len = fileSystem.getFileStatus(path).getLen();
- this.stream = fileSystem.open(path);
+ final FileStatus st = fileSystem.getFileStatus(path);
+ this.len = st.getLen();
+ // use the hadoop 3.3.0 openFile API, pass in status
+ // and read policy. object stores can use these to
+ // optimize read performance.
+ // the read policy "adaptive" means "start sequential but
+ // go to random IO when considered better"
+ // Filesystems which don't recognize the options will ignore them
+ // Importantly deployments which have switched the default read policy to
+ // "random"
+ // will not suffer when reading large avro files.
+ this.stream = awaitFuture(fileSystem.openFile(path)
+ .opt(FS_OPTION_OPENFILE_READ_POLICY,
FS_OPTION_OPENFILE_READ_POLICY_ADAPTIVE).withFileStatus(st).build());
Review Comment:
need to add the same fallback code as in parquet; s3a connector in
3.3.0-3.3.4 validates the whole path, and overreacts to hive's wrapping of the
fs by its own VFS; 3.3.5+ only look at the filename.
--
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]