This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 1cafa4b  Allow custom FileSystem logic in HadoopTableOperations. (#15)
1cafa4b is described below

commit 1cafa4b58409b0ca3284fd33345e7914388c2c07
Author: mccheah <[email protected]>
AuthorDate: Tue Nov 27 11:22:16 2018 -0800

    Allow custom FileSystem logic in HadoopTableOperations. (#15)
---
 .../netflix/iceberg/hadoop/HadoopTableOperations.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/core/src/main/java/com/netflix/iceberg/hadoop/HadoopTableOperations.java 
b/core/src/main/java/com/netflix/iceberg/hadoop/HadoopTableOperations.java
index 345caa0..875643e 100644
--- a/core/src/main/java/com/netflix/iceberg/hadoop/HadoopTableOperations.java
+++ b/core/src/main/java/com/netflix/iceberg/hadoop/HadoopTableOperations.java
@@ -45,7 +45,7 @@ import static 
com.netflix.iceberg.TableMetadataParser.getFileExtension;
  * <p>
  * This maintains metadata in a "metadata" folder under the table location.
  */
-class HadoopTableOperations implements TableOperations {
+public class HadoopTableOperations implements TableOperations {
   private static final Logger LOG = 
LoggerFactory.getLogger(HadoopTableOperations.class);
 
   private final Configuration conf;
@@ -54,7 +54,7 @@ class HadoopTableOperations implements TableOperations {
   private Integer version = null;
   private boolean shouldRefresh = true;
 
-  HadoopTableOperations(Path location, Configuration conf) {
+  protected HadoopTableOperations(Path location, Configuration conf) {
     this.conf = conf;
     this.location = location;
   }
@@ -70,7 +70,7 @@ class HadoopTableOperations implements TableOperations {
   public TableMetadata refresh() {
     int ver = version != null ? version : readVersionHint();
     Path metadataFile = metadataFile(ver);
-    FileSystem fs = Util.getFS(metadataFile, conf);
+    FileSystem fs = getFS(metadataFile, conf);
     try {
       // don't check if the file exists if version is non-null because it was 
already checked
       if (version == null && !fs.exists(metadataFile)) {
@@ -112,7 +112,7 @@ class HadoopTableOperations implements TableOperations {
 
     int nextVersion = (version != null ? version : 0) + 1;
     Path finalMetadataFile = metadataFile(nextVersion);
-    FileSystem fs = Util.getFS(tempMetadataFile, conf);
+    FileSystem fs = getFS(tempMetadataFile, conf);
 
     try {
       if (fs.exists(finalMetadataFile)) {
@@ -154,7 +154,7 @@ class HadoopTableOperations implements TableOperations {
   @Override
   public void deleteFile(String path) {
     Path toDelete = new Path(path);
-    FileSystem fs = Util.getFS(toDelete, conf);
+    FileSystem fs = getFS(toDelete, conf);
     try {
       fs.delete(toDelete, false /* not recursive */ );
     } catch (IOException e) {
@@ -181,7 +181,7 @@ class HadoopTableOperations implements TableOperations {
 
   private void writeVersionHint(int version) {
     Path versionHintFile = versionHintFile();
-    FileSystem fs = Util.getFS(versionHintFile, conf);
+    FileSystem fs = getFS(versionHintFile, conf);
 
     try (FSDataOutputStream out = fs.create(versionHintFile, true /* overwrite 
*/ )) {
       out.write(String.valueOf(version).getBytes("UTF-8"));
@@ -207,4 +207,8 @@ class HadoopTableOperations implements TableOperations {
       throw new RuntimeIOException(e, "Failed to get file system for path: 
%s", versionHintFile);
     }
   }
+
+  protected FileSystem getFS(Path path, Configuration conf) {
+    return Util.getFS(path, conf);
+  }
 }

Reply via email to