clairemcginty commented on code in PR #16935:
URL: https://github.com/apache/iceberg/pull/16935#discussion_r3460285931


##########
core/src/main/java/org/apache/iceberg/ManifestLists.java:
##########
@@ -32,16 +32,12 @@
 class ManifestLists {
   private ManifestLists() {}
 
-  static InputFile newInputFile(FileIO io, ManifestListFile manifestList) {
-    InputFile input = io.newInputFile(manifestList);
-    if (ManifestFiles.cachingEnabled(io)) {
-      return ManifestFiles.contentCache(io).tryCache(input);
+  static List<ManifestFile> read(InputFile manifestList) {
+    if (!manifestList.exists()) {
+      throw new NotFoundException(
+          "Failed to read manifest list: file %s does not exist", 
manifestList.location());
     }

Review Comment:
   In practice it shouldn't actually introduce another FS call -- in all the 
implementations of `InputFile#exists` that I looked at, `exists()` will cache 
the result of the filesystem lookup and re-use it later on during the scan 
operation when `InputFile#getLength` is invoked. For example, for GCS you can 
see how the `getBlob()` computation is re-used:
   
   
https://github.com/apache/iceberg/blob/7c13104c8c20323c895aeb33fe5ca1f3b127889f/gcp/src/main/java/org/apache/iceberg/gcp/gcs/BaseGCSFile.java#L79-L89
   
   
https://github.com/apache/iceberg/blob/7c13104c8c20323c895aeb33fe5ca1f3b127889f/gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputFile.java#L64-L71
   
   However, it's true that this is implementation-specific, there's nothing in 
the `InputFile` contract that guarantees this caching behavior. Happy to make 
the suggested change to GCS impl specifically if you prefer.



-- 
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