Copilot commented on code in PR #3927:
URL: https://github.com/apache/iceberg-python/pull/3927#discussion_r3976541494
##########
pyiceberg/catalog/hive.py:
##########
@@ -506,8 +507,15 @@ def load_view(self, identifier: str | Identifier) -> View:
raise NotImplementedError
def _create_lock_request(self, database_name: str, table_name: str) ->
LockRequest:
+ # Iceberg commits do not open a metastore transaction, so the lock is
marked NO_TXN. Setting it explicitly
+ # also matters for Hive 2.1, which rejects a lock component left at
the default UNSET operation type.
Review Comment:
The new comment says commits don’t open a metastore transaction, but the
code still sets `isTransactional=True`, which makes the comment read as
internally inconsistent. Consider rewording the comment to only assert what’s
actually being changed/relied on (`operationType=NO_TXN` and Hive 2.1 rejecting
`UNSET`).
##########
pyiceberg/catalog/hive.py:
##########
@@ -506,8 +507,15 @@ def load_view(self, identifier: str | Identifier) -> View:
raise NotImplementedError
def _create_lock_request(self, database_name: str, table_name: str) ->
LockRequest:
+ # Iceberg commits do not open a metastore transaction, so the lock is
marked NO_TXN. Setting it explicitly
+ # also matters for Hive 2.1, which rejects a lock component left at
the default UNSET operation type.
lock_component: LockComponent = LockComponent(
- level=LockLevel.TABLE, type=LockType.EXCLUSIVE,
dbname=database_name, tablename=table_name, isTransactional=True
+ level=LockLevel.TABLE,
+ type=LockType.EXCLUSIVE,
+ dbname=database_name,
+ tablename=table_name,
+ operationType=DataOperationType.NO_TXN,
Review Comment:
This change fixes a Hive 2.1.0-specific commit failure by setting
`operationType=NO_TXN`, but there’s no unit test covering the lock request
shape. Adding a small unit test for `_create_lock_request` (asserting the
component’s `operationType` is `DataOperationType.NO_TXN`) would help prevent
regressions.
--
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]