Commit 9846386
committed
HIVE-29461: Iceberg: HIVE_METASTORE_WAREHOUSE_EXTERNAL is ignored when initializing HiveCatalog
HiveCatalog.initialize() propagated CatalogProperties.WAREHOUSE_LOCATION to the
Hadoop configuration but ignored the equivalent external-warehouse property, so
getExternalWarehouseLocation() and convertToDatabase() failed with an NPE
("Warehouse location is not set: hive.metastore.warehouse.external.dir=null")
whenever a caller reached HiveCatalog through the standard Iceberg
Catalog.initialize(name, properties) API without separately mutating the
Configuration. Callers worked around this either by re-setting the value on the
Configuration before initialize() (HMSCatalogFactory) or by relying on a
side-channel setConf() carrying the value through (IcebergSummaryHandler), and
in both cases used a different, undocumented property key
("external-warehouse" vs "externalwarehouse").
Add HiveCatalog.EXTERNAL_WAREHOUSE_LOCATION ("external-warehouse") as the
canonical catalog property and propagate it from initialize() to
hive.metastore.warehouse.external.dir, mirroring the existing handling for
WAREHOUSE_LOCATION (including LocationUtil.stripTrailingSlash). Update the two
in-tree callers to use the constant and drop HMSCatalogFactory's redundant
configuration.set() workaround. The unhyphenated key in IcebergSummaryHandler
was effectively dead code (HiveCatalog never read it) and is replaced rather
than retained.
Adds testInitializeCatalogWithExternalWarehouseProperty mirroring
testInitializeCatalogWithProperties to lock in the propagation behavior.1 parent ee6848d commit 9846386
4 files changed
Lines changed: 30 additions & 4 deletions
File tree
- iceberg
- iceberg-catalog/src
- main/java/org/apache/iceberg/hive
- test/java/org/apache/iceberg/hive
- iceberg-handler/src/main/java/org/apache/iceberg/metasummary
- standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
286 | 302 | | |
287 | 303 | | |
288 | 304 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 88 | + | |
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
| |||
0 commit comments