Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ def _initial_changes(self, table_metadata: TableMetadata) -> None:

schema: Schema = table_metadata.schema()
self._updates += (
AddSchemaUpdate(schema_=schema, last_column_id=schema.highest_field_id),
AddSchemaUpdate(schema_=schema),
SetCurrentSchemaUpdate(schema_id=-1),
)

Expand Down
11 changes: 0 additions & 11 deletions pyiceberg/table/update/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
transform_dict_value_to_str,
)
from pyiceberg.utils.datetime import datetime_to_millis
from pyiceberg.utils.deprecated import deprecation_notice
from pyiceberg.utils.properties import property_as_int

if TYPE_CHECKING:
Expand Down Expand Up @@ -92,16 +91,6 @@ class UpgradeFormatVersionUpdate(IcebergBaseModel):
class AddSchemaUpdate(IcebergBaseModel):
action: Literal["add-schema"] = Field(default="add-schema")
schema_: Schema = Field(alias="schema")
# This field is required: https://github.com/apache/iceberg/pull/7445
last_column_id: Optional[int] = Field(
alias="last-column-id",
default=None,
deprecated=deprecation_notice(
deprecated_in="0.9.0",
removed_in="0.10.0",
help_message="last-field-id is handled internally, and should not be part of the update.",
),
)


class SetCurrentSchemaUpdate(IcebergBaseModel):
Expand Down
3 changes: 1 addition & 2 deletions pyiceberg/table/update/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,8 @@ def _commit(self) -> UpdatesAndRequirements:
if existing_schema_id != self._schema.schema_id:
requirements += (AssertCurrentSchemaId(current_schema_id=self._schema.schema_id),)
if existing_schema_id is None:
last_column_id = max(self._transaction.table_metadata.last_column_id, new_schema.highest_field_id)
updates += (
AddSchemaUpdate(schema=new_schema, last_column_id=last_column_id),
AddSchemaUpdate(schema=new_schema),
SetCurrentSchemaUpdate(schema_id=-1),
)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/catalog/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def test_commit_table(catalog: InMemoryCatalog) -> None:
response = given_table.catalog.commit_table(
given_table,
updates=(
AddSchemaUpdate(schema=new_schema, last_column_id=new_schema.highest_field_id),
AddSchemaUpdate(schema=new_schema),
SetCurrentSchemaUpdate(schema_id=-1),
),
requirements=(),
Expand Down
1 change: 0 additions & 1 deletion tests/catalog/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,6 @@ def test_create_staged_table_200(
"schema-id": 0,
"identifier-field-ids": [],
},
"last-column-id": 2,
},
{"action": "set-current-schema", "schema-id": -1},
{"action": "add-spec", "spec": {"spec-id": 0, "fields": []}},
Expand Down