You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/12/03 03:04:46 UTC
[PR] Fix downgrading of schema [iceberg-python]
Fokko opened a new pull request, #176:
URL: https://github.com/apache/iceberg-python/pull/176
(no comment)
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix downgrading of schema [iceberg-python]
Posted by "HonahX (via GitHub)" <gi...@apache.org>.
HonahX commented on code in PR #176:
URL: https://github.com/apache/iceberg-python/pull/176#discussion_r1413005467
##########
pyiceberg/table/__init__.py:
##########
@@ -1412,13 +1412,22 @@ def commit(self) -> None:
"""Apply the pending changes and commit."""
new_schema = self._apply()
- if new_schema != self._schema:
- last_column_id = max(self._table.metadata.last_column_id, new_schema.highest_field_id)
- updates = (
- AddSchemaUpdate(schema=new_schema, last_column_id=last_column_id),
- SetCurrentSchemaUpdate(schema_id=-1),
- )
+ existing_schema_id: Optional[int] = None
+ for schema in self._table.metadata.schemas:
+ if new_schema == schema:
+ existing_schema_id = schema.schema_id
Review Comment:
Shall we add a `break` here? Or may be:
```python
existing_schema_id = next(
(schema.schema_id for schema in self.schemas if schema == new_schema), None)
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix downgrading of schema [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on PR #176:
URL: https://github.com/apache/iceberg-python/pull/176#issuecomment-1837794358
Thanks @danielcweeks and @HonahX for the review 🙌
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix downgrading of schema [iceberg-python]
Posted by "HonahX (via GitHub)" <gi...@apache.org>.
HonahX commented on code in PR #176:
URL: https://github.com/apache/iceberg-python/pull/176#discussion_r1413005467
##########
pyiceberg/table/__init__.py:
##########
@@ -1412,13 +1412,22 @@ def commit(self) -> None:
"""Apply the pending changes and commit."""
new_schema = self._apply()
- if new_schema != self._schema:
- last_column_id = max(self._table.metadata.last_column_id, new_schema.highest_field_id)
- updates = (
- AddSchemaUpdate(schema=new_schema, last_column_id=last_column_id),
- SetCurrentSchemaUpdate(schema_id=-1),
- )
+ existing_schema_id: Optional[int] = None
+ for schema in self._table.metadata.schemas:
+ if new_schema == schema:
+ existing_schema_id = schema.schema_id
Review Comment:
Shall we add a `break` here?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix downgrading of schema [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #176:
URL: https://github.com/apache/iceberg-python/pull/176#discussion_r1413327467
##########
pyiceberg/table/__init__.py:
##########
@@ -1412,13 +1412,22 @@ def commit(self) -> None:
"""Apply the pending changes and commit."""
new_schema = self._apply()
- if new_schema != self._schema:
- last_column_id = max(self._table.metadata.last_column_id, new_schema.highest_field_id)
- updates = (
- AddSchemaUpdate(schema=new_schema, last_column_id=last_column_id),
- SetCurrentSchemaUpdate(schema_id=-1),
- )
+ existing_schema_id: Optional[int] = None
+ for schema in self._table.metadata.schemas:
+ if new_schema == schema:
+ existing_schema_id = schema.schema_id
Review Comment:
Oh, your suggestion is beautiful, thanks!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix downgrading of schema [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #176:
URL: https://github.com/apache/iceberg-python/pull/176
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org