amogh-jahagirdar commented on code in PR #9283:
URL: https://github.com/apache/iceberg/pull/9283#discussion_r1430571350
##########
core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java:
##########
@@ -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);
Review Comment:
Sorry for the delay, it looks like Nessie Catalog does not really test that
path (`TestNessieCatalog`) as far as I can tell but we don't necessarily need
to follow the same here. I think we could add a test to `TestHadoopCatalog`
which looks something like the following:
```
@ Test
public void testHadoopFileIOProperties() {
String warehouseLocation = tableDir.getAbsolutePath();
HadoopCatalog catalog = new HadoopCatalog();
catalog.setConf(new Configuration());
catalog.initialize(
"hadoop", ImmutableMap.of(CatalogProperties.WAREHOUSE_LOCATION,
warehouseLocation, "some-file-io-property", "some-file-io-value"));
TableIdentifier tableIdent = TableIdentifier.of("db", "ns1", "ns2",
"tbl");
catalog.buildTable(tableIdent, SCHEMA).withPartitionSpec(SPEC).create();
FileIO fileIO = catalog.newTableOps(tableIdent).io();
assertThat(fileIO.properties().get(CatalogProperties.WAREHOUSE_LOCATION)).equals(warehouseLocation)
assertThat(fileIO.properties().get("some-file-io-property)).equals("some-file-io.value")
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]