@@ -146,7 +146,15 @@ def can_transform(self, source: IcebergType) -> bool:
146
146
return False
147
147
148
148
@abstractmethod
149
- def result_type (self , source : IcebergType ) -> IcebergType : ...
149
+ def result_type (self , source : IcebergType ) -> IcebergType :
150
+ """Return the `IcebergType` produced by this transform given a source type.
151
+
152
+ This method defines both the physical and display representation of the partition field.
153
+
154
+ The physical representation must conform to the Iceberg spec. The display representation
155
+ can deviate from the spec, such as by transforming the value into a more human-readable format.
156
+ """
157
+ ...
150
158
151
159
@abstractmethod
152
160
def project (self , name : str , pred : BoundPredicate [L ]) -> Optional [UnboundPredicate [Any ]]: ...
@@ -491,7 +499,7 @@ class DayTransform(TimeTransform[S]):
491
499
"""Transforms a datetime value into a day value.
492
500
493
501
Example:
494
- >>> transform = MonthTransform ()
502
+ >>> transform = DayTransform ()
495
503
>>> transform.transform(DateType())(17501)
496
504
17501
497
505
"""
@@ -518,6 +526,11 @@ def can_transform(self, source: IcebergType) -> bool:
518
526
return isinstance (source , (DateType , TimestampType , TimestamptzType ))
519
527
520
528
def result_type (self , source : IcebergType ) -> IcebergType :
529
+ """Return the result type of a day transform.
530
+
531
+ The physical representation conforms to the Iceberg spec as DateType is internally converted to int.
532
+ The DateType returned here provides a more human-readable way to display the partition field.
533
+ """
521
534
return DateType ()
522
535
523
536
@property
0 commit comments