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


##########
pyiceberg/types.py:
##########
@@ -432,6 +432,15 @@ class NestedField(IcebergType):
     initial_default: DefaultValue | None = Field(alias="initial-default", 
default=None, repr=True)  # type: ignore
     write_default: DefaultValue | None = Field(alias="write-default", 
default=None, repr=True)  # type: ignore
 
+    @property
+    def _initial_default_value(self) -> object:
+        """Return the initial-default as bound literals hold it: days or 
microseconds for temporal types."""
+        if self.initial_default is not None and isinstance(self.field_type, 
(DateType, TimeType, TimestampType, TimestamptzType)):
+            from pyiceberg.expressions.literals import literal
+
+            return literal(self.initial_default).to(self.field_type).value
+        return self.initial_default

Review Comment:
   Wouldn't it make more sense to do this when we create the type? We know the 
type then right away.



-- 
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]

Reply via email to