Fokko commented on code in PR #4409:
URL: https://github.com/apache/iceberg-python/pull/4409#discussion_r4611181611
##########
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:
Ideally we don't want to guess based on the number of bytes. But I guess
that ship has sailed, since we do the same for the float/double case ðŸ˜
@rahulsmahadev Are you intersted in kicking your LLM of to see if we can remove
those cases, and actually rely on the type?
--
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]