jayceslesar commented on code in PR #2410:
URL: https://github.com/apache/iceberg-python/pull/2410#discussion_r2356988959
##########
tests/integration/test_catalog.py:
##########
@@ -247,6 +252,59 @@ def test_table_exists(test_catalog: Catalog,
table_schema_nested: Schema, databa
assert test_catalog.table_exists((database_name, table_name)) is True
[email protected]
[email protected]("test_catalog", CATALOGS)
+def test_incompatible_partitioned_schema_evolution(
+ test_catalog: Catalog, test_schema: Schema, test_partition_spec:
PartitionSpec, database_name: str, table_name: str
+) -> None:
+ if isinstance(test_catalog, HiveCatalog):
+ pytest.skip("HiveCatalog does not support schema evolution")
+
+ identifier = (database_name, table_name)
+ test_catalog.create_namespace(database_name)
+ table = test_catalog.create_table(identifier, test_schema,
partition_spec=test_partition_spec)
+ assert test_catalog.table_exists(identifier)
+
+ with pytest.raises(ValidationError):
+ with table.update_schema() as update:
+ update.delete_column("VendorID")
+
+ # Assert column was not dropped
+ assert "VendorID" in table.schema().column_names
+
+ with table.transaction() as transaction:
+ with transaction.update_spec() as spec_update:
+ spec_update.remove_field("VendorID")
+
+ with transaction.update_schema() as schema_update:
+ schema_update.delete_column("VendorID")
+
+ assert table.spec() == PartitionSpec(PartitionField(2, 1001,
DayTransform(), "tpep_pickup_day"), spec_id=1)
+ assert table.schema() == Schema(NestedField(2, "tpep_pickup_datetime",
TimestampType(), False))
Review Comment:
Part of me wonders if it makes sense to test this here? Like yes we should
be testing commit_table generally with different types of updates on all
catalogs but this test seems maybe a little further away? Not going to turn
down more tests but just a thought!
--
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]