Fokko commented on code in PR #2365:
URL: https://github.com/apache/iceberg-python/pull/2365#discussion_r2289204315
##########
pyiceberg/schema.py:
##########
@@ -1760,8 +1769,16 @@ def _is_field_compatible(self, lhs: NestedField) -> bool:
promote(rhs.field_type, lhs.field_type)
self.rich_table.add_row("✅", str(lhs), str(rhs))
return True
- except ResolveError:
- self.rich_table.add_row("❌", str(lhs), str(rhs))
+ except ResolveError as e:
+ # UnknownType can only be promoted to Primitive types
+ if isinstance(rhs.field_type, UnknownType):
+ if isinstance(lhs.field_type, (ListType, MapType,
StructType)):
+ error_msg = f"PyArrow null type (UnknownType) cannot
be promoted to non-primitive type {lhs.field_type}. UnknownType can only be
promoted to primitive types (string, int, boolean, etc.) in V3+ tables."
+ else:
+ error_msg = f"PyArrow null type (UnknownType) cannot
be promoted to {lhs.field_type}. This may be due to table format version
limitations (V1/V2 tables don't support UnknownType promotion)."
Review Comment:
I would leave out the `PyArrow` null type since this is in `schema.py`,
rather than `pyarrow.py`.
--
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]