kevinjqliu commented on code in PR #523:
URL: https://github.com/apache/iceberg-python/pull/523#discussion_r1538537111
##########
pyiceberg/table/__init__.py:
##########
@@ -1156,7 +1166,9 @@ def overwrite(
if len(self.spec().fields) > 0:
raise ValueError("Cannot write to partitioned tables")
- _check_schema(self.schema(), other_schema=df.schema)
+ _check_schema_compatible(self.schema(), other_schema=df.schema)
+ # the two schemas are compatible so safe to cast
+ df = df.cast(self.schema().as_arrow())
Review Comment:
It was too complicated when `_check_schema_compatible` returned a boolean
and threw an error.
I ended up doing an extra comparison as Arrow schemas outside and cast only
if necessary
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]