jayceslesar commented on code in PR #2410:
URL: https://github.com/apache/iceberg-python/pull/2410#discussion_r2456987187
##########
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:
I think that is a very valid reason!
--
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]