transforms
BoundTransform
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
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 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 |
|
DayTransform
Bases: TimeTransform[S]
Transforms a datetime value into a day value.
Example
transform = MonthTransform() transform.transform(DateType())(17501) 17501
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
__repr__()
__str__()
satisfies_order_of(other)
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.
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
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
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