Fokko commented on code in PR #4597:
URL: https://github.com/apache/iceberg-python/pull/4597#discussion_r4784154793
##########
pyiceberg/catalog/hive.py:
##########
@@ -369,7 +383,7 @@ def _convert_iceberg_into_hive(self, table: Table) ->
HiveTable:
return HiveTable(
dbName=database_name,
tableName=table_name,
- owner=table.properties[OWNER] if table.properties and OWNER in
table.properties else getpass.getuser(),
+ owner=get_first_property_value(table.properties or {}, OWNER,
HIVE_METASTORE_TABLE_OWNER) or getpass.getuser(),
Review Comment:
Java strips `hive.metastore.table.owner` from the HMS table parameters on
both create and commit (`HMSTablePropertyHelper.java:94` and `:146`). Here it
is still copied into the parameters via `_construct_parameters`. Could we
filter it out and assert that in the test?
##########
pyiceberg/catalog/hive.py:
##########
@@ -235,12 +239,22 @@ def _construct_parameters(
def _annotate_namespace(database: HiveDatabase, properties: Properties) ->
HiveDatabase:
+ if HIVE_METASTORE_DATABASE_OWNER_TYPE in properties and
HIVE_METASTORE_DATABASE_OWNER not in properties:
+ raise ValueError(f"{HIVE_METASTORE_DATABASE_OWNER_TYPE} requires
{HIVE_METASTORE_DATABASE_OWNER}")
+
params = {}
for key, value in properties.items():
if key == COMMENT:
database.description = value
elif key == LOCATION:
Review Comment:
Java returns the owner from `loadNamespaceMetadata`
(`HiveCatalog.java:806-808`) and supports removing both owner keys
(`HiveCatalog.java:652-655`). Here `load_namespace_properties` doesn't return
them, and removing `hive.metastore.database.owner` via
`update_namespace_properties` reports it as missing. Could we handle both so
the property round-trips?
--
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]