danielcweeks commented on code in PR #405:
URL: https://github.com/apache/iceberg-python/pull/405#discussion_r1485172192
##########
tests/integration/test_reads.py:
##########
@@ -467,3 +469,26 @@ def test_null_list_and_map(catalog: Catalog) -> None:
# assert arrow_table["col_list_with_struct"].to_pylist() == [None,
[{'test': 1}]]
# Once https://github.com/apache/arrow/issues/38809 has been fixed
assert arrow_table["col_list_with_struct"].to_pylist() == [[], [{'test':
1}]]
+
+
[email protected]
+def test_hive_locking(catalog_hive: HiveCatalog) -> None:
+ table = create_table(catalog_hive)
+
+ database_name: str
+ table_name: str
+ _, database_name, table_name = table.identifier
+
+ hive_client: _HiveClient = catalog_hive._client
+ blocking_lock_request: LockRequest =
catalog_hive._create_lock_request(database_name, table_name)
+
+ with hive_client as open_client:
+ # Force a lock on the test table
+ lock: LockResponse = open_client.lock(blocking_lock_request)
+ assert lock.state == LockState.ACQUIRED
+
+ try:
+ with pytest.raises(CommitFailedException, match="Cannot acquire
lock"):
+
table.transaction().set_properties(lock="fail").commit_transaction()
+ finally:
+ open_client.unlock(UnlockRequest(lock.lockid))
Review Comment:
I saw this after I reworked the locking logic, but I like this approach much
better.
--
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]