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


##########
pyiceberg/types.py:
##########
@@ -469,6 +471,11 @@ def __init__(
         data["initial-default"] = data["initial-default"] if "initial-default" 
in data else initial_default
         data["write-default"] = data["write-default"] if "write-default" in 
data else write_default
         super().__init__(**data)
+        self._initial_default_value = self.initial_default
+        if self.initial_default is not None and isinstance(self.field_type, 
(DateType, TimeType, TimestampType, TimestamptzType)):
+            from pyiceberg.expressions.literals import literal
+
+            self._initial_default_value = 
literal(self.initial_default).to(self.field_type).value

Review Comment:
   Thanks for checking. Done in 2dd2e427 with a `None` check: non-null defaults 
now use `literal(initial_default).to(field_type).value`, the same conversion as 
`add_column`, so conversion errors surface when the field is created; for 
example, `Decimal("1.2")` for `decimal(9, 2)` is rejected.
   



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