Skip to content

Commit

Permalink
use Schema.as_arrow()
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjqliu committed Mar 24, 2024
1 parent 3dcc344 commit 05e7444
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,6 @@ def overwrite(
except ModuleNotFoundError as e:
raise ModuleNotFoundError("For writes PyArrow needs to be installed") from e

from pyiceberg.io.pyarrow import schema_to_pyarrow

if not isinstance(df, pa.Table):
raise ValueError(f"Expected PyArrow table, got: {df}")

Expand All @@ -1160,8 +1158,7 @@ def overwrite(

_check_schema(self.schema(), other_schema=df.schema)
# safe to cast
pyarrow_schema = schema_to_pyarrow(self.schema())
df = df.cast(pyarrow_schema)
df = df.cast(self.schema().as_arrow())

with self.transaction() as txn:
with txn.update_snapshot(snapshot_properties=snapshot_properties).overwrite() as update_snapshot:
Expand Down

0 comments on commit 05e7444

Please sign in to comment.