Fokko commented on code in PR #8305:
URL: https://github.com/apache/iceberg/pull/8305#discussion_r1293586793
##########
python/pyiceberg/schema.py:
##########
@@ -1276,14 +1276,13 @@ def primitive(self, primitive: PrimitiveType) ->
Optional[IcebergType]:
@staticmethod
def _project_selected_struct(projected_field: Optional[IcebergType]) ->
StructType:
- if projected_field and not isinstance(projected_field, StructType):
- raise ValueError("Expected a struct")
-
if projected_field is None:
return StructType()
- else:
+ if isinstance(projected_field, StructType):
return projected_field
+ raise ValueError("Expected a struct")
Review Comment:
```suggestion
raise ValueError(f"Expected a struct, got: {projected_field}")
```
##########
python/pyiceberg/transforms.py:
##########
@@ -463,8 +463,8 @@ def can_transform(self, source: IcebergType) -> bool:
TimestamptzType,
}
- def result_type(self, source: IcebergType) -> IcebergType:
- return DateType()
+ def result_type(self, source: IcebergType) -> IntegerType:
Review Comment:
Great catch, thanks!
##########
python/pyiceberg/types.py:
##########
@@ -422,7 +422,8 @@ class BooleanType(PrimitiveType):
BooleanType()
"""
- __root__ = "boolean"
+ def __init__(self) -> None:
+ super().__init__(__root__="boolean")
Review Comment:
Do we really need these constructors? I ran into issues with them in
combination with Pydantic 2: https://github.com/apache/iceberg/pull/7782/files
--
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]