Copilot commented on code in PR #3842:
URL: https://github.com/apache/iceberg-python/pull/3842#discussion_r3847363784
##########
pyiceberg/avro/resolver.py:
##########
@@ -461,7 +461,10 @@ def primitive(self, primitive: PrimitiveType,
expected_primitive: IcebergType |
# ensure that the type can be projected to the expected
if primitive != expected_primitive:
- promote(primitive, expected_primitive)
+ if isinstance(primitive, LongType) and
isinstance(expected_primitive, IntegerType):
+ pass
+ else:
+ promote(primitive, expected_primitive)
Review Comment:
This special case widens the resolver for every `LongType` → `IntegerType`
projection, not just legacy manifest field 136. A long-valued field can now
bypass `promote` and be accepted as an int; `IntegerReader` returns the full
Python integer without a 32-bit range check, so out-of-range values are
silently accepted even though Avro/Iceberg do not permit this narrowing. Keep
the generic narrowing rejection and scope the compatibility shim to
`equality_ids` (or use a separate legacy manifest read schema).
--
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]