jun-he commented on code in PR #5462:
URL: https://github.com/apache/iceberg/pull/5462#discussion_r951044641
##########
python/pyiceberg/utils/datetime.py:
##########
@@ -116,3 +131,33 @@ def to_human_timestamptz(timestamp_micros: int) -> str:
def to_human_timestamp(timestamp_micros: int) -> str:
"""Converts a TimestampType value to human string"""
return (EPOCH_TIMESTAMP +
timedelta(microseconds=timestamp_micros)).isoformat()
+
+
+def micros_to_hours(timestamp: int) -> int:
+ """Converts a timestamp in microseconds to a date in hours"""
+ return int((datetime.utcfromtimestamp(timestamp / 1_000_000) -
EPOCH_TIMESTAMP).total_seconds() / 3600)
Review Comment:
SG, but we still have to cast it to int as total_seconds returns a float.
--
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]