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 Deprecated 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(int numBuckets)Returns a bucketTransformfor the given number of buckets.static <T> Transform<T,java.lang.Integer>bucket(Type type, int numBuckets)Deprecated.usebucket(int)instead; will be removed in 2.0.0static <T> Transform<T,java.lang.Integer>day()Returns a dayTransformfor date or timestamp types.static <T> Transform<T,java.lang.Integer>day(Type type)Deprecated.useday()instead; will be removed in 2.0.0static Transform<?,?>fromString(java.lang.String transform)static Transform<?,?>fromString(Type type, java.lang.String transform)static <T> Transform<T,java.lang.Integer>hour()Returns an hourTransformfor timestamp types.static <T> Transform<T,java.lang.Integer>hour(Type type)Deprecated.usehour()instead; will be removed in 2.0.0static <T> Transform<T,T>identity()Returns an identityTransformthat can be used for any type.static <T> Transform<T,T>identity(Type type)Deprecated.useidentity()instead; will be removed in 2.0.0static <T> Transform<T,java.lang.Integer>month()Returns a monthTransformfor date or timestamp types.static <T> Transform<T,java.lang.Integer>month(Type type)Deprecated.usemonth()instead; will be removed in 2.0.0static <T> Transform<T,T>truncate(int width)Returns a truncateTransformfor the given width.static <T> Transform<T,T>truncate(Type type, int width)Deprecated.usetruncate(int)instead; will be removed in 2.0.0static <T> Transform<T,java.lang.Integer>year()Returns a yearTransformfor date or timestamp types.static <T> Transform<T,java.lang.Integer>year(Type type)Deprecated.useyear()instead; will be removed in 2.0.0
-
-
-
Method Detail
-
fromString
public static Transform<?,?> fromString(java.lang.String transform)
-
identity
@Deprecated public static <T> Transform<T,T> identity(Type type)
Deprecated.useidentity()instead; will be removed in 2.0.0Returns 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
@Deprecated public static <T> Transform<T,java.lang.Integer> year(Type type)
Deprecated.useyear()instead; will be removed in 2.0.0Returns 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
@Deprecated public static <T> Transform<T,java.lang.Integer> month(Type type)
Deprecated.usemonth()instead; will be removed in 2.0.0Returns 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
@Deprecated public static <T> Transform<T,java.lang.Integer> day(Type type)
Deprecated.useday()instead; will be removed in 2.0.0Returns 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
@Deprecated public static <T> Transform<T,java.lang.Integer> hour(Type type)
Deprecated.usehour()instead; will be removed in 2.0.0Returns an hourTransformfor timestamps.- Type Parameters:
T- Java type passed to this transform- Parameters:
type- thesource typefor the transform- Returns:
- an hour transform
-
bucket
@Deprecated public static <T> Transform<T,java.lang.Integer> bucket(Type type, int numBuckets)
Deprecated.usebucket(int)instead; will be removed in 2.0.0Returns 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
@Deprecated public static <T> Transform<T,T> truncate(Type type, int width)
Deprecated.usetruncate(int)instead; will be removed in 2.0.0Returns 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
-
identity
public static <T> Transform<T,T> identity()
Returns an identityTransformthat can be used for any type.- Type Parameters:
T- Java type passed to this transform- Returns:
- an identity transform
-
year
public static <T> Transform<T,java.lang.Integer> year()
Returns a yearTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Returns:
- a year transform
-
month
public static <T> Transform<T,java.lang.Integer> month()
Returns a monthTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Returns:
- a month transform
-
day
public static <T> Transform<T,java.lang.Integer> day()
Returns a dayTransformfor date or timestamp types.- Type Parameters:
T- Java type passed to this transform- Returns:
- a day transform
-
hour
public static <T> Transform<T,java.lang.Integer> hour()
Returns an hourTransformfor timestamp types.- Type Parameters:
T- Java type passed to this transform- Returns:
- an hour transform
-
bucket
public static <T> Transform<T,java.lang.Integer> bucket(int numBuckets)
Returns a bucketTransformfor 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
public static <T> Transform<T,T> truncate(int width)
Returns a truncateTransformfor 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
-
-