Package org.apache.iceberg.transforms
Class Transforms
java.lang.Object
org.apache.iceberg.transforms.Transforms
Factory methods for transforms.
Most users should create transforms using a PartitionSpec.builderFor(Schema)
partition
spec builder}.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns aTransform
that always produces null.bucket
(int numBuckets) Returns a bucketTransform
for the given number of buckets.Deprecated.day()
Returns a dayTransform
for date or timestamp types.Deprecated.useday()
instead; will be removed in 2.0.0static Transform
<?, ?> fromString
(String transform) static Transform
<?, ?> fromString
(Type type, String transform) Deprecated.useidentity()
instead; will be removed in 2.0.0hour()
Returns an hourTransform
for timestamp types.Deprecated.usehour()
instead; will be removed in 2.0.0static <T> Transform
<T, T> identity()
Returns an identityTransform
that can be used for any type.static <T> Transform
<T, T> Deprecated.useidentity()
instead; will be removed in 2.0.0month()
Returns a monthTransform
for date or timestamp types.Deprecated.usemonth()
instead; will be removed in 2.0.0static <T> Transform
<T, T> truncate
(int width) Returns a truncateTransform
for the given width.static <T> Transform
<T, T> Deprecated.usetruncate(int)
instead; will be removed in 2.0.0year()
Returns a yearTransform
for date or timestamp types.Deprecated.useyear()
instead; will be removed in 2.0.0
-
Method Details
-
fromString
-
fromString
Deprecated.useidentity()
instead; will be removed in 2.0.0 -
identity
Deprecated.useidentity()
instead; will be removed in 2.0.0Returns an identityTransform
that can be used for any type.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- an identity transform
-
year
Deprecated.useyear()
instead; will be removed in 2.0.0Returns a yearTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- a year transform
-
month
Deprecated.usemonth()
instead; will be removed in 2.0.0Returns a monthTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- a month transform
-
day
Deprecated.useday()
instead; will be removed in 2.0.0Returns a dayTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- a day transform
-
hour
Deprecated.usehour()
instead; will be removed in 2.0.0Returns an hourTransform
for timestamps.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- an hour transform
-
bucket
Deprecated.usebucket(int)
instead; will be removed in 2.0.0Returns a bucketTransform
for the given type and number of buckets.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transformnumBuckets
- the number of buckets for the transform to produce- Returns:
- a transform that buckets values into numBuckets
-
truncate
Deprecated.usetruncate(int)
instead; will be removed in 2.0.0Returns a truncateTransform
for the given type and width.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transformwidth
- the width to truncate data values- Returns:
- a transform that truncates the given type to width
-
identity
Returns an identityTransform
that can be used for any type.- Type Parameters:
T
- Java type passed to this transform- Returns:
- an identity transform
-
year
Returns a yearTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Returns:
- a year transform
-
month
Returns a monthTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Returns:
- a month transform
-
day
Returns a dayTransform
for date or timestamp types.- Type Parameters:
T
- Java type passed to this transform- Returns:
- a day transform
-
hour
Returns an hourTransform
for timestamp types.- Type Parameters:
T
- Java type passed to this transform- Returns:
- an hour transform
-
bucket
Returns a bucketTransform
for the given number of buckets.- Type Parameters:
T
- Java type passed to this transform- Parameters:
numBuckets
- the number of buckets for the transform to produce- Returns:
- a transform that buckets values into numBuckets
-
truncate
Returns a truncateTransform
for the given width.- Type Parameters:
T
- Java type passed to this transform- Parameters:
width
- the width to truncate data values- Returns:
- a transform that truncates the given type to width
-
alwaysNull
Returns aTransform
that always produces null.- Type Parameters:
T
- Java type accepted by the transform.- Returns:
- a transform that always produces null (the void transform).
-
bucket(int)
instead; will be removed in 2.0.0