rdblue commented on a change in pull request #14: Pluggable file I/O submodule 
in TableOperations
URL: https://github.com/apache/incubator-iceberg/pull/14#discussion_r240438485
 
 

 ##########
 File path: core/src/test/java/com/netflix/iceberg/TestTables.java
 ##########
 @@ -173,14 +174,39 @@ public void commit(TableMetadata base, TableMetadata 
metadata) {
       }
     }
 
+    @Override
+    public FileIO io() {
+      return new LocalFileIO();
+    }
+
+    @Override
+    public String metadataFileLocation(String fileName) {
+      return new File(metadata, fileName).getAbsolutePath();
+    }
+
+    @Override
+    public long newSnapshotId() {
+      long nextSnapshotId = lastSnapshotId + 1;
+      this.lastSnapshotId = nextSnapshotId;
+      return nextSnapshotId;
+    }
+  }
+
+  static class LocalFileIO implements FileIO {
+
     @Override
     public InputFile newInputFile(String path) {
       return Files.localInput(path);
     }
 
     @Override
-    public OutputFile newMetadataFile(String filename) {
-      return Files.localOutput(new File(metadata, filename));
+    public OutputFile newOutputFile(String path) {
+      File file = new File(path);
+      if (!file.getParentFile().isDirectory() && 
!file.getParentFile().mkdirs()) {
 
 Review comment:
   Why does this run `mkdir`? I don't think the output file should make any 
changes until requested by a `create` call.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to