Skip to content

Commit

Permalink
Correctly handle schema-id == 0 from Snapshot (#211)
Browse files Browse the repository at this point in the history
* fix snapshot schema issue: wrong usage of walrus operator

* Update pyiceberg/table/__init__.py

Co-authored-by: Fokko Driesprong <fokko@apache.org>

---------

Co-authored-by: Fokko Driesprong <fokko@apache.org>
  • Loading branch information
tonyps1223 and Fokko authored Dec 13, 2023
1 parent 3b5d3f3 commit 2bd8cf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,8 @@ def snapshot(self) -> Optional[Snapshot]:
def projection(self) -> Schema:
snapshot_schema = self.table.schema()
if snapshot := self.snapshot():
if snapshot_schema_id := snapshot.schema_id:
snapshot_schema = self.table.schemas()[snapshot_schema_id]
if snapshot.schema_id is not None:
snapshot_schema = self.table.schemas()[snapshot.schema_id]

if "*" in self.selected_fields:
return snapshot_schema
Expand Down

0 comments on commit 2bd8cf2

Please sign in to comment.