Fokko commented on code in PR #523:
URL: https://github.com/apache/iceberg-python/pull/523#discussion_r1538172665


##########
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:
   Should `_check_schema_compatible` return a bool to indicate if the cast is 
needed? I'm not sure how costly the cast is. If we go from `string` to 
`large_string` then we might rewrite the Arrow buffers.



-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to