Skip to content

Commit 7fcdb8d

Browse files
authored
call as_arrow() once (#565)
1 parent 7e3e508 commit 7fcdb8d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pyiceberg/table/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,9 @@ def overwrite(
11731173

11741174
_check_schema_compatible(self.schema(), other_schema=df.schema)
11751175
# cast if the two schemas are compatible but not equal
1176-
if self.schema().as_arrow() != df.schema:
1177-
df = df.cast(self.schema().as_arrow())
1176+
table_arrow_schema = self.schema().as_arrow()
1177+
if table_arrow_schema != df.schema:
1178+
df = df.cast(table_arrow_schema)
11781179

11791180
with self.transaction() as txn:
11801181
with txn.update_snapshot(snapshot_properties=snapshot_properties).overwrite() as update_snapshot:

0 commit comments

Comments
 (0)