apache / apache/iceberg

Hive: add HiveCatalog(Configuration, Map<String, String>) convenience constructor

Open Beginner friendly
#16,134 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.2k
Forks
3.5k
Avg merge
2d 16h
Merged PRs (30d)
129

Description

### Feature Request / Improvement

`HiveCatalog.initialize(name, properties)` reads several keys from the property map (`URI`, `WAREHOUSE_LOCATION`, after #YYYY also `external-warehouse`) and from the Hadoop `Configuration` (HMS thrift URIs, kerberos, SSL, `SERVLET_ID_KEY`, etc.). Callers that already have both a fully-populated `Configuration` and a property map currently need a two-step dance:

```java
HiveCatalog catalog = new HiveCatalog();
catalog.setConf(configuration);
catalog.initialize(name, properties);
```

`HadoopCatalog` exposes a convenience constructor for the analogous case ([HadoopCatalog L137-140](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L137-L140)):

```java
public HadoopCatalog(Configuration conf, String warehouseLocation) {
setConf(conf);
initialize("hadoop", ImmutableMap.of(CatalogProperties.WAREHOUSE_LOCATION, warehouseLocation));
}
```

Adding the equivalent for `HiveCatalog` — accepting a property map since `HiveCatalog` reads more than one key — would let downstream callers drop the manual `setConf` + `initialize` pair:

```java
public HiveCatalog(Configuration conf, Map properties) {
setConf(conf);
initialize("hive", properties);
}
```

Surfaced in apache/hive#6454 review thread — the Hive-side `HMSCatalogFactory` would be the first adopter once this lands.

### Query engine

Other

### Willingness to contribute

- [x] I can contribute this improvement/feature independently

Contributor guide

Open the contributing guide

Research direction

Start in HiveCatalog and compare the convenience-constructor pattern at HadoopCatalog L137-140. Confirm how HiveCatalog.initialize(name, properties) consumes the property map and Configuration, then verify that the new constructor preserves that initialization behavior and removes the manual setConf plus initialize sequence for HMSCatalogFactory callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.