pvary commented on a change in pull request #2340:
URL: https://github.com/apache/iceberg/pull/2340#discussion_r597555828



##########
File path: core/src/main/java/org/apache/iceberg/StaticTableOperations.java
##########
@@ -29,24 +29,37 @@
  * and cannot be used to create or delete files.
  */
 public class StaticTableOperations implements TableOperations {
-  private final TableMetadata staticMetadata;
+  private TableMetadata staticMetadata;
+  private final String metadataFileLocation;
   private final FileIO io;
+  private final LocationProvider locationProvider;
 
   /**
    * Creates a StaticTableOperations tied to a specific static version of the 
TableMetadata
    */
   public StaticTableOperations(String metadataFileLocation, FileIO io) {
+    this(metadataFileLocation, io, null);
+  }
+
+  public StaticTableOperations(String metadataFileLocation, FileIO io, 
LocationProvider locationProvider) {
     this.io = io;
-    this.staticMetadata = TableMetadataParser.read(io, metadataFileLocation);
+    this.metadataFileLocation = metadataFileLocation;
+    this.locationProvider = locationProvider;
   }
 
   @Override
   public TableMetadata current() {
+    if (staticMetadata == null) {
+      staticMetadata = TableMetadataParser.read(io, metadataFileLocation);
+    }
     return staticMetadata;
   }
 
   @Override
   public TableMetadata refresh() {
+    if (staticMetadata == null) {

Review comment:
       Comment is needed, but I think not doing anything is the best option.
   Calling `current()` calls metadata parsing, which might be unnecessary if 
the metadata is not used later.




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

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