Fokko commented on code in PR #1539:
URL: https://github.com/apache/iceberg-python/pull/1539#discussion_r1922769699


##########
pyiceberg/partitioning.py:
##########
@@ -425,8 +426,13 @@ def _to_partition_representation(type: IcebergType, value: 
Any) -> Any:
 
 @_to_partition_representation.register(TimestampType)
 @_to_partition_representation.register(TimestamptzType)
-def _(type: IcebergType, value: Optional[datetime]) -> Optional[int]:
-    return datetime_to_micros(value) if value is not None else None
+def _(type: IcebergType, value: Optional[Union[datetime, int]]) -> 
Optional[int]:
+    if value is None:
+        return None
+    elif isinstance(value, int):
+        return value

Review Comment:
   It has to do that the same path is being used in both add-files and when 
writing. I've changed the logic slightly and added a comment. Let me know what 
you think!



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to