JoniKet commented on code in PR #1580:
URL: https://github.com/apache/iceberg-python/pull/1580#discussion_r1931766744
##########
pyiceberg/catalog/hive.py:
##########
@@ -404,7 +404,22 @@ def register_table(self, identifier: Union[str,
Identifier], metadata_location:
Raises:
TableAlreadyExistsError: If the table already exists
"""
- raise NotImplementedError
+ database_name, table_name =
self.identifier_to_database_and_table(identifier)
+ io = self._load_file_io(location=metadata_location)
+ metadata_file = io.new_input(metadata_location)
+ staged_table = StagedTable(
+ identifier=(database_name, table_name),
+ metadata=FromInputFile.table_metadata(metadata_file),
+ metadata_location=metadata_location,
+ io=io,
+ catalog=self,
+ )
+ tbl = self._convert_iceberg_into_hive(staged_table)
+ with self._client as open_client:
Review Comment:
Thanks for the review !
Not sure why hive lock would be necessary for creating the table, as Fokko
mentioned exception would be raised in case the table already exists. For
writes or metadata updates lock is necessary.
Perhaps on some very edge case two clients which do register_table request
at same time could lead to issues, but I think getting the table lock is almost
as fast operation as creating the table.
https://github.com/apache/iceberg-python/blob/985029042199d870f25b6fbec0e80907d4440f41/pyiceberg/catalog/hive.py#L336-L340
--
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]