transforms
BucketTransform
¶
Bases: Transform[S, int]
Base Transform class to transform a value into a bucket partition value.
Transforms are parameterized by a number of buckets. Bucket partition transforms use a 32-bit hash of the source value to produce a positive value by mod the bucket number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_buckets
|
int
|
The number of buckets. |
required |
Source code in pyiceberg/transforms.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
DayTransform
¶
Bases: TimeTransform[S]
Transforms a datetime value into a day value.
Example
transform = DayTransform() transform.transform(DateType())(17501) 17501
Source code in pyiceberg/transforms.py
__repr__()
¶
result_type(source)
¶
Return the result type of a day transform.
The physical representation conforms to the Iceberg spec as DateType is internally converted to int. The DateType returned here provides a more human-readable way to display the partition field.
Source code in pyiceberg/transforms.py
HourTransform
¶
Bases: TimeTransform[S]
Transforms a datetime value into a hour value.
Example
transform = HourTransform() transform.transform(TimestampType())(1512151975038194) 420042
Source code in pyiceberg/transforms.py
IdentityTransform
¶
Bases: Transform[S, S]
Transforms a value into itself.
Example
transform = IdentityTransform() transform.transform(StringType())('hello-world') 'hello-world'
Source code in pyiceberg/transforms.py
MonthTransform
¶
Bases: TimeTransform[S]
Transforms a datetime value into a month value.
Example
transform = MonthTransform() transform.transform(DateType())(17501) 575
Source code in pyiceberg/transforms.py
Transform
¶
Bases: IcebergRootModel[str]
, ABC
, Generic[S, T]
Transform base class for concrete transforms.
A base class to transform values and project predicates on partition values. This class is not used directly. Instead, use one of module method to create the child classes.
Source code in pyiceberg/transforms.py
__eq__(other)
¶
Return the equality of two instances of the Transform class.
__str__()
¶
result_type(source)
abstractmethod
¶
Return the IcebergType
produced by this transform given a source type.
This method defines both the physical and display representation of the partition field.
The physical representation must conform to the Iceberg spec. The display representation can deviate from the spec, such as by transforming the value into a more human-readable format.
Source code in pyiceberg/transforms.py
TruncateTransform
¶
Bases: Transform[S, S]
A transform for truncating a value to a specified width.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The truncate width, should be positive. |
required |
Raises: ValueError: If a type is provided that is incompatible with a Truncate transform.
Source code in pyiceberg/transforms.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 |
|
UnknownTransform
¶
Bases: Transform[S, T]
A transform that represents when an unknown transform is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transform
|
str
|
A string name of a transform. |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
source_type |
IcebergType
|
An Iceberg |
Source code in pyiceberg/transforms.py
VoidTransform
¶
Bases: Transform[S, None]
, Singleton
A transform that always returns None.
Source code in pyiceberg/transforms.py
YearTransform
¶
Bases: TimeTransform[S]
Transforms a datetime value into a year value.
Example
transform = YearTransform() transform.transform(TimestampType())(1512151975038194) 47