Fokko commented on code in PR #405:
URL: https://github.com/apache/iceberg-python/pull/405#discussion_r1484994993


##########
pyiceberg/catalog/hive.py:
##########
@@ -155,7 +164,7 @@ def _construct_hive_storage_descriptor(schema: Schema, 
location: Optional[str])
 PROP_TABLE_TYPE = "table_type"
 PROP_METADATA_LOCATION = "metadata_location"
 PROP_PREVIOUS_METADATA_LOCATION = "previous_metadata_location"
-DEFAULT_PROPERTIES = {TableProperties.PARQUET_COMPRESSION: 
TableProperties.PARQUET_COMPRESSION_DEFAULT}
+DEFAULT_PROPERTIES = {'write.parquet.compression-codec': 'zstd'}

Review Comment:
   ```suggestion
   DEFAULT_PROPERTIES = {TableProperties.PARQUET_COMPRESSION: 
TableProperties.PARQUET_COMPRESSION_DEFAULT}
   ```



##########
pyiceberg/catalog/hive.py:
##########
@@ -67,7 +76,7 @@
 from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
 from pyiceberg.schema import Schema, SchemaVisitor, visit
 from pyiceberg.serializers import FromInputFile
-from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
TableProperties, update_table_metadata
+from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
update_table_metadata

Review Comment:
   ```suggestion
   from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
TableProperties, update_table_metadata```



##########
tests/integration/test_reads.py:
##########
@@ -467,3 +469,27 @@ 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}]]
+
+
+@pytest.mark.integration
+@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive')])
+def test_hive_locking(catalog: HiveCatalog) -> None:
+    table = create_table(catalog)
+
+    database_name: str
+    table_name: str
+    _ignored, database_name, table_name = table.identifier
+
+    hive_client: _HiveClient = catalog._client
+    blocking_lock_request: LockRequest = 
catalog._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:
   ```suggestion
   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._client
       blocking_lock_request: LockRequest = 
catalog._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))
   ```



##########
pyiceberg/catalog/hive.py:
##########
@@ -67,7 +76,7 @@
 from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
 from pyiceberg.schema import Schema, SchemaVisitor, visit
 from pyiceberg.serializers import FromInputFile
-from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
TableProperties, update_table_metadata
+from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
update_table_metadata

Review Comment:
   ```suggestion
   from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, 
TableProperties, update_table_metadata
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to