geruh commented on code in PR #3293:
URL: https://github.com/apache/iceberg-python/pull/3293#discussion_r3165097449
##########
pyiceberg/expressions/visitors.py:
##########
@@ -73,6 +75,18 @@
T = TypeVar("T")
+def _from_bytes_with_promotion(field_type: PrimitiveType, b: bytes) -> Any:
Review Comment:
maybe we can plumb with a single dispatch handler just how we do in our
to_bytes converters.
```python
@from_bytes.register(LongType)
def _(_: LongType, b: bytes)
if len(b) == 4:
return _INT_STRUCT.unpack(b)[0]
return _LONG_STRUCT.unpack(b)[0]
```
Java side actually has it in a helper so it can be used throughout code
base:
https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/types/Conversions.java#L147-L163.
--
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]