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



##########
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:
       We have a couple of negative test cases that tries to modify 
StaticTables. Obviously, the operation will fail with an exception during 
commit(), but before it does it tries to create a snapshot that calls 
refresh(). If we return null, we will run into a nullpointer exception. 




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