Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ public void initialize(String name, Map<String, String> properties) {
this.warehouseLocation = LocationUtil.stripTrailingSlash(inputWarehouseLocation);
this.fs = Util.getFs(new Path(warehouseLocation), conf);

String fileIOImpl = properties.get(CatalogProperties.FILE_IO_IMPL);
this.fileIO =
fileIOImpl == null
? new HadoopFileIO(conf)
: CatalogUtil.loadFileIO(fileIOImpl, properties, conf);
String fileIOImpl =
properties.getOrDefault(
CatalogProperties.FILE_IO_IMPL, "org.apache.iceberg.hadoop.HadoopFileIO");

this.fileIO = CatalogUtil.loadFileIO(fileIOImpl, properties, conf);

this.lockManager = LockManagers.from(properties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ public void testBasicCatalog() throws Exception {
Assertions.assertThat(fs.isDirectory(new Path(metaLocation))).isFalse();
}

@Test
public void testHadoopFileIOProperties() {
TableIdentifier tableIdent = TableIdentifier.of("db", "ns1", "ns2", "tbl");
ImmutableMap<String, String> catalogProps =
ImmutableMap.of(
"warehouse", "/hive/testwarehouse",
"io.manifest.cache-enabled", "true");

HadoopCatalog catalog = new HadoopCatalog();
catalog.setConf(new Configuration());
catalog.initialize("hadoop", catalogProps);
FileIO fileIO = catalog.newTableOps(tableIdent).io();

Assertions.assertThat(fileIO.properties()).containsEntry("warehouse", "/hive/testwarehouse");
Assertions.assertThat(fileIO.properties()).containsEntry("io.manifest.cache-enabled", "true");
}

@Test
public void testCreateAndDropTableWithoutNamespace() throws Exception {
HadoopCatalog catalog = hadoopCatalog();
Expand Down