Skip to content

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

@1fanwang

Description

@1fanwang

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:

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

HadoopCatalog exposes a convenience constructor for the analogous case (HadoopCatalog L137-140):

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:

public HiveCatalog(Configuration conf, Map<String, String> 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

  • I can contribute this improvement/feature independently

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions