1fanwang commented on PR #17894: URL: https://github.com/apache/iceberg/pull/17894#issuecomment-7174679554
> Could the user just use `CatalogUtil`? > ``` > CatalogUtil.loadCatalog(HiveCatalog.class.getName(), name, props, conf); > ``` CatalogUtil.loadCatalog works, but through two reflective steps: a reflective no-arg constructor call, then a [reflective setConf dispatch](https://github.com/apache/iceberg/blob/6cf1f6e4e6cfa6210f0017466283be6d01acab68/core/src/main/java/org/apache/iceberg/CatalogUtil.java#L434-L501), because [HiveCatalog implements Hadoop's Configurable](https://github.com/apache/iceberg/blob/6cf1f6e4e6cfa6210f0017466283be6d01acab68/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L82), not Iceberg's own. It also returns Catalog, so getConf() needs a cast back to HiveCatalog. [HadoopCatalog already has this same reflection-free constructor shape](https://github.com/apache/iceberg/blob/6cf1f6e4e6cfa6210f0017466283be6d01acab68/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L138); this PR extends it to HiveCatalog. -- 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]
