You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by am...@apache.org on 2023/12/19 15:14:05 UTC
(iceberg) branch main updated: Forward properties in HadoopCatalog initialization to the default HadoopFileIO (#9283)
This is an automated email from the ASF dual-hosted git repository.
amoghj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new c2018f8949 Forward properties in HadoopCatalog initialization to the default HadoopFileIO (#9283)
c2018f8949 is described below
commit c2018f894920ff6c50190c2b4ee113a4b10fb15a
Author: Reetika <ag...@gmail.com>
AuthorDate: Tue Dec 19 20:43:58 2023 +0530
Forward properties in HadoopCatalog initialization to the default HadoopFileIO (#9283)
---
.../java/org/apache/iceberg/hadoop/HadoopCatalog.java | 10 +++++-----
.../org/apache/iceberg/hadoop/TestHadoopCatalog.java | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java b/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
index 166551fe55..e9ed4dcd28 100644
--- a/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
@@ -112,11 +112,11 @@ public class HadoopCatalog extends BaseMetastoreCatalog
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);
diff --git a/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java b/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
index 4b01eead5d..8365129a56 100644
--- a/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
+++ b/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
@@ -221,6 +221,23 @@ public class TestHadoopCatalog extends HadoopTableTestBase {
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();