Fokko commented on code in PR #5011:
URL: https://github.com/apache/iceberg/pull/5011#discussion_r907809100
##########
python/src/iceberg/types.py:
##########
@@ -59,134 +62,176 @@ class IcebergType:
'IcebergType()'
"""
- @property
- def string_type(self) -> str:
- return self.__repr__()
-
- def __str__(self) -> str:
- return self.string_type
+ @classmethod
+ def __get_validators__(cls):
+ # one or more validators may be yielded which will be called in the
+ # order to validate the input, each validator will receive as an input
+ # the value returned from the previous validator
+ yield cls.validate
+
+ @classmethod
+ def validate(cls, v):
Review Comment:
Doesn't look like the `parse_obj`/`parse_raw` gets invoked. The
`IcebergType` is a bit of a special case, since it cannot be invoked, I think
it would be okay to (mis)use the validator there. It gets called because it is
part of the schema:
```
class Schema:
fields: Tuple[IcebergType. ...]
```
When deserializing, it will first visit the IcebergType for validation. We
can then handle the special cases for the decimal and fixed.
--
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]