Fokko commented on code in PR #4409:
URL: https://github.com/apache/iceberg-python/pull/4409#discussion_r4620208657
##########
pyiceberg/conversions.py:
##########
@@ -352,14 +356,28 @@ def _(_: PrimitiveType, b: bytes) -> int:
@from_bytes.register(TimeType)
-@from_bytes.register(TimestampType)
@from_bytes.register(TimestamptzType)
-@from_bytes.register(TimestampNanoType)
@from_bytes.register(TimestamptzNanoType)
def _(_: PrimitiveType, b: bytes) -> int:
return _LONG_STRUCT.unpack(b)[0]
+@from_bytes.register(TimestampType)
+def _(_: TimestampType, b: bytes) -> int:
+ if len(b) < 8:
+ # If the length is 4 bytes, it is a date promoted to timestamp, stored
as days from the epoch
+ return _INT_STRUCT.unpack(b)[0] * _MICROS_PER_DAY
Review Comment:
Yes, you are right. The bounds does not store the type (yet). This will be
fixed in V4. Let's move this forward in the meantime then 👍 Thanks for looking
into this
--
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]