Skip to content

Commit

Permalink
handle external paths
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyaug committed Oct 18, 2023
1 parent 095e5b7 commit 69e3be5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/io/lakefs/iceberg/LakeFSFileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ public Map<String, String> properties() {
return wrapped.properties();
}


@Override
public InputFile newInputFile(String path) {
if (!path.startsWith("s3a://")) {
path = String.format("s3a://%s/%s/%s", lakeFSRepo, lakeFSRef, path);
}
if (!path.startsWith(String.format("s3a://%s/%s/", lakeFSRepo, lakeFSRef))) {
// not a path in the repository, treat as a regular path
return wrapped.newInputFile(path);
}
return HadoopInputFile.fromPath(new LakeFSPath(path), wrapped.conf());
}

Expand All @@ -44,6 +47,10 @@ public InputFile newInputFile(String path, long length) {
if (!path.startsWith("s3a://")) {
path = String.format("s3a://%s/%s/%s", lakeFSRepo, lakeFSRef, path);
}
if (!path.startsWith(String.format("s3a://%s/%s/", lakeFSRepo, lakeFSRef))) {
// not a path in the repository, treat as a regular path
return wrapped.newInputFile(path, length);
}
return HadoopInputFile.fromPath(new LakeFSPath(path), length, wrapped.conf());
}

Expand All @@ -52,6 +59,10 @@ public OutputFile newOutputFile(String path) {
if (!path.startsWith("s3a://")) {
path = String.format("s3a://%s/%s/%s", lakeFSRepo, lakeFSRef, path);
}
if (!path.startsWith(String.format("s3a://%s/%s/", lakeFSRepo, lakeFSRef))) {
// not a path in the repository, treat as a regular path
return wrapped.newOutputFile(path);
}
return HadoopOutputFile.fromPath(new LakeFSPath(path), wrapped.conf());
}

Expand Down

0 comments on commit 69e3be5

Please sign in to comment.