singhpk234 opened a new pull request, #5864:
URL: https://github.com/apache/iceberg/pull/5864
### About the change
In case we call both exists() & getLength() we make a redundant call to
`getFileStatus` as `fs.exists(path)` internally checks
```java
/** Check if exists.
* @param f source file
*/
public boolean exists(Path f) throws IOException {
try {
return getFileStatus(f) != null;
} catch (FileNotFoundException e) {
return false;
}
}
```
So we could getFileStatus directly and cache it via lazyStat() in `stat`
prop and in `getLength` & subsequent calls directly return it.
Note : This similar opt exists in S3InputFile as well as we cache the
results in `getObjectMetadata` call
https://github.com/apache/iceberg/blob/b9bbcfb0e4d8f2605d3c6fb2543cefdd5d09524d/aws/src/main/java/org/apache/iceberg/aws/s3/BaseS3File.java#L70
----
### Testing Done
Existing UT's
--
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]