ebyhr commented on code in PR #4305:
URL: https://github.com/apache/iceberg-python/pull/4305#discussion_r4510973559
##########
tests/table/test_init.py:
##########
@@ -1522,6 +1522,20 @@ def test_last_assigned_partition_id(table_v2: Table) ->
None:
AssertLastAssignedPartitionId(last_assigned_partition_id=1).validate(base_metadata)
+def test_update_spec_rejects_duplicate_partition_name(table_v2: Table) -> None:
+ txn = table_v2.transaction()
+ txn.update_spec().add_field("y", BucketTransform(16), "y_bucket").commit()
+
+ with pytest.raises(ValueError, match="Partition name has to be unique:
y_bucket"):
+ txn.update_spec().rename_field("x", "y_bucket").commit()
+
+ with pytest.raises(ValueError, match="Partition name has to be unique:
z_bucket"):
+ txn.update_spec().rename_field("y_bucket", "z_bucket").add_field("z",
BucketTransform(16), "z_bucket").commit()
+
+ with pytest.raises(ValueError, match="Undefined name"):
Review Comment:
Move the empty-name case to its own test, since it isn't about duplicate
names.
--
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]