Package org.apache.iceberg.transforms
Class Transforms
- java.lang.Object
-
- org.apache.iceberg.transforms.Transforms
-
public class Transforms extends java.lang.Object
Factory methods for transforms.Most users should create transforms using a
PartitionSpec.builderFor(Schema)
partition spec builder}.- See Also:
The partition spec builder.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Transform<T,java.lang.Void>
alwaysNull()
Returns aTransform
that always produces null.static <T> Transform<T,java.lang.Integer>
bucket(Type type, int numBuckets)
Returns a bucketTransform
for the given type and number of buckets.static <T> Transform<T,java.lang.Integer>
day(Type type)
Returns a dayTransform
for date or timestamp types.static Transform<?,?>
fromString(Type type, java.lang.String transform)
static <T> Transform<T,java.lang.Integer>
hour(Type type)
Returns a hourTransform
for timestamps.static <T> Transform<T,T>
identity(Type type)
Returns an identityTransform
that can be used for any type.static <T> Transform<T,java.lang.Integer>
month(Type type)
Returns a monthTransform
for date or timestamp types.static <T> Transform<T,T>
truncate(Type type, int width)
Returns a truncateTransform
for the given type and width.static <T> Transform<T,java.lang.Integer>
year(Type type)
Returns a yearTransform
for date or timestamp types.
-
-
-
Method Detail
-
identity
public static <T> Transform<T,T> identity(Type type)
Returns 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
public static <T> Transform<T,java.lang.Integer> year(Type type)
Returns 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
public static <T> Transform<T,java.lang.Integer> month(Type type)
Returns 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
public static <T> Transform<T,java.lang.Integer> day(Type type)
Returns 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
public static <T> Transform<T,java.lang.Integer> hour(Type type)
Returns a hourTransform
for timestamps.- Type Parameters:
T
- Java type passed to this transform- Parameters:
type
- thesource type
for the transform- Returns:
- a hour transform
-
bucket
public static <T> Transform<T,java.lang.Integer> bucket(Type type, int numBuckets)
Returns 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
public static <T> Transform<T,T> truncate(Type type, int width)
Returns 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
-
-