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 Deprecated 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(int numBuckets)
Returns a bucketTransform
for 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 dayTransform
for 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 hourTransform
for 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 identityTransform
that 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 monthTransform
for 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 truncateTransform
for 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 yearTransform
for 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 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 public static <T> Transform<T,java.lang.Integer> year(Type type)
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 public static <T> Transform<T,java.lang.Integer> month(Type type)
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 public static <T> Transform<T,java.lang.Integer> day(Type type)
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 public static <T> Transform<T,java.lang.Integer> hour(Type type)
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 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 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 public static <T> Transform<T,T> truncate(Type type, int width)
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
public static <T> Transform<T,T> 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
public static <T> Transform<T,java.lang.Integer> year()
Returns a yearTransform
for 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 monthTransform
for 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 dayTransform
for 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 hourTransform
for 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 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
public static <T> Transform<T,T> truncate(int width)
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
-
-