Skip to content

Commit fddc9f4

Browse files
committed
skip AddPartitionSpecUpdate for initial
1 parent 175b4dd commit fddc9f4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyiceberg/table/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,11 @@ def _(update: SetCurrentSchemaUpdate, base_metadata: TableMetadata, context: _Ta
10151015

10161016
@_apply_table_update.register(AddPartitionSpecUpdate)
10171017
def _(update: AddPartitionSpecUpdate, base_metadata: TableMetadata, context: _TableMetadataUpdateContext) -> TableMetadata:
1018+
context.add_update(update)
1019+
if update.spec.spec_id == INITIAL_PARTITION_SPEC_ID:
1020+
# no op
1021+
return base_metadata
1022+
10181023
for spec in base_metadata.partition_specs:
10191024
if spec.spec_id == update.spec.spec_id:
10201025
raise ValueError(f"Partition spec with id {spec.spec_id} already exists: {spec}")
@@ -1027,7 +1032,6 @@ def _(update: AddPartitionSpecUpdate, base_metadata: TableMetadata, context: _Ta
10271032
),
10281033
}
10291034

1030-
context.add_update(update)
10311035
return base_metadata.model_copy(update=metadata_updates)
10321036

10331037

0 commit comments

Comments
 (0)