Package org.apache.iceberg.transforms
Class Transforms
- java.lang.Object
-
- org.apache.iceberg.transforms.Transforms
-
public class Transforms extends java.lang.ObjectFactory 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 aTransformthat always produces null.static <T> Transform<T,java.lang.Integer>bucket(Type type, int numBuckets)Returns a bucketTransformfor the given type and number of buckets.static <T> Transform<T,java.lang.Integer>day(Type type)Returns a dayTransformfor 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 hourTransformfor timestamps.static <T> Transform<T,T>identity(Type type)Returns an identityTransformthat can be used for any type.static <T> Transform<T,java.lang.Integer>month(Type type)Returns a monthTransformfor date or timestamp types.static <T> Transform<T,T>truncate(Type type, int width)Returns a truncateTransformfor the given type and width.static <T> Transform<T,java.lang.Integer>year(Type type)Returns a yearTransformfor date or timestamp types.
-
-
-
Method Detail
-
identity
public static <T> Transform<T,T> identity(Type type)
Returns an identityTransformthat can be used for any type.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- an identity transform
-
year
public static <T> Transform<T,java.lang.Integer> year(Type type)
Returns a yearTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- a year transform
-
month
public static <T> Transform<T,java.lang.Integer> month(Type type)
Returns a monthTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- a month transform
-
day
public static <T> Transform<T,java.lang.Integer> day(Type type)
Returns a dayTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- a day transform
-
hour
public static <T> Transform<T,java.lang.Integer> hour(Type type)
Returns a hourTransformfor timestamps.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- a hour transform
-
bucket
public static <T> Transform<T,java.lang.Integer> bucket(Type type, int numBuckets)
Returns a bucketTransformfor the given type and number of buckets.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor 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 truncateTransformfor the given type and width.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transformwidth- the width to truncate data values- Returns:
- a transform that truncates the given type to width
-
-