-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from treeverse/handle_external_paths
- Loading branch information
Showing
2 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.lakefs.iceberg; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.iceberg.hadoop.HadoopFileIO; | ||
import org.apache.iceberg.io.InputFile; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class TestLakeFSFileIO { | ||
|
||
private LakeFSFileIO lakeFSFileIO; | ||
|
||
@Before | ||
public void setUp() { | ||
HadoopFileIO hadoopFileIO = new HadoopFileIO(new Configuration()); | ||
String lakeFSRepo = "myLakeFSRepo"; | ||
String lakeFSRef = "myLakeFSRef"; | ||
lakeFSFileIO = new LakeFSFileIO(hadoopFileIO, lakeFSRepo, lakeFSRef); | ||
} | ||
|
||
@Test | ||
public void testNewInputFile() { | ||
// Test the behavior of newInputFile method | ||
String relativePath = "path/in/repo"; | ||
String absolutePath = "s3a://myLakeFSRepo/myLakeFSRef/other/path/in/repo"; | ||
String externalPath = "s3a://otherBucket/otherPath"; | ||
InputFile relativeInputFile = lakeFSFileIO.newInputFile(relativePath); | ||
Assert.assertEquals("path/in/repo", relativeInputFile.location()); | ||
InputFile absoluteInputFile = lakeFSFileIO.newInputFile(absolutePath); | ||
Assert.assertEquals("other/path/in/repo", absoluteInputFile.location()); | ||
InputFile externalInputFile = lakeFSFileIO.newInputFile(externalPath); | ||
Assert.assertEquals("s3a://otherBucket/otherPath", externalInputFile.location()); | ||
} | ||
} |