public static class PartitionStrategy.Builder extends Object
PartitionStrategy
s.Constructor and Description |
---|
PartitionStrategy.Builder() |
Modifier and Type | Method and Description |
---|---|
PartitionStrategy |
build()
Build a configured
PartitionStrategy instance. |
PartitionStrategy.Builder |
dateFormat(String sourceName,
String name,
String format)
Configure a partitioner that applies a custom date format to a timestamp
field.
|
PartitionStrategy.Builder |
day(String sourceName)
Configure a partitioner for extracting the day from a timestamp field.
|
PartitionStrategy.Builder |
day(String sourceName,
String name)
Configure a partitioner for extracting the day from a timestamp field.
|
PartitionStrategy.Builder |
hash(String sourceName,
int buckets)
Configure a hash partitioner with the specified number of
buckets . |
PartitionStrategy.Builder |
hash(String sourceName,
String name,
int buckets)
Configure a hash partitioner with the specified number of
buckets . |
PartitionStrategy.Builder |
hour(String sourceName)
Configure a partitioner for extracting the hour from a timestamp field.
|
PartitionStrategy.Builder |
hour(String sourceName,
String name)
Configure a partitioner for extracting the hour from a timestamp field.
|
PartitionStrategy.Builder |
identity(String sourceName)
Configure an identity partitioner.
|
PartitionStrategy.Builder |
identity(String sourceName,
int cardinalityHint)
Configure an identity partitioner with a cardinality hint of
cardinalityHint . |
PartitionStrategy.Builder |
identity(String sourceName,
String name)
Configure an identity partitioner.
|
PartitionStrategy.Builder |
identity(String sourceName,
String name,
int cardinalityHint)
Configure an identity partitioner with a cardinality hint of
cardinalityHint . |
PartitionStrategy.Builder |
minute(String sourceName)
Configure a partitioner for extracting the minute from a timestamp field.
|
PartitionStrategy.Builder |
minute(String sourceName,
String name)
Configure a partitioner for extracting the minute from a timestamp field.
|
PartitionStrategy.Builder |
month(String sourceName)
Configure a partitioner for extracting the month from a timestamp field.
|
PartitionStrategy.Builder |
month(String sourceName,
String name)
Configure a partitioner for extracting the month from a timestamp field.
|
PartitionStrategy.Builder |
provided(String name)
Configure a partitioner that uses values always provided at runtime.
|
PartitionStrategy.Builder |
provided(String name,
String valuesType)
Configure a partitioner that uses values always provided at runtime.
|
PartitionStrategy.Builder |
range(String sourceName,
int... upperBounds)
Configure a range partitioner with a set of
upperBounds . |
PartitionStrategy.Builder |
range(String sourceName,
String... upperBounds)
Configure a range partitioner for strings with a set of
upperBounds . |
PartitionStrategy.Builder |
year(String sourceName)
Configure a partitioner for extracting the year from a timestamp field.
|
PartitionStrategy.Builder |
year(String sourceName,
String name)
Configure a partitioner for extracting the year from a timestamp field.
|
public PartitionStrategy.Builder hash(String sourceName, int buckets)
buckets
.
The partition name is the source field name with a "_hash" suffix.
For example, hash("color", 34) creates "color_hash" partitions.sourceName
- The entity field name from which to get values to be
partitioned.buckets
- The number of buckets into which data is to be partitioned.public PartitionStrategy.Builder hash(String sourceName, @Nullable String name, int buckets)
buckets
. If name is null, the partition name will be the source
field name with a "_hash" suffix. For example, hash("color", null, 34)
will create "color_hash" partitions.sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.buckets
- The number of buckets into which data is to be partitioned.public PartitionStrategy.Builder identity(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.IdentityFieldPartitioner
public PartitionStrategy.Builder identity(String sourceName, String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- A name for the partition fieldIdentityFieldPartitioner
public PartitionStrategy.Builder identity(String sourceName, int cardinalityHint)
cardinalityHint
.
The partition name is the source field name with a "_copy" suffix.
For example, identity("color", String.class, 34) creates "color_copy"
partitions.sourceName
- The entity field name from which to get values to be
partitioned.cardinalityHint
- A hint as to the number of partitions that will be created (i.e.
the number of discrete values for the field name
in the
data).IdentityFieldPartitioner
public PartitionStrategy.Builder identity(String sourceName, String name, int cardinalityHint)
cardinalityHint
. If name is null, the partition name will be the source
field name with a "_copy" suffix. For example, identity("color", null, ...)
will create "color_copy" partitions.sourceName
- The entity field name from which to get values to be
partitioned.name
- A name for the partition fieldcardinalityHint
- A hint as to the number of partitions that will be created (i.e.
the number of discrete values for the field name
in the
data).IdentityFieldPartitioner
public PartitionStrategy.Builder range(String sourceName, int... upperBounds)
upperBounds
.
The partition name will be the source field name with a "_bound" suffix.
For example, range("number", 5, 10) creates "number_bound"
partitions.sourceName
- The entity field name from which to get values to be
partitioned.upperBounds
- A variadic list of upper bounds of each partition.IntRangeFieldPartitioner
public PartitionStrategy.Builder range(String sourceName, String... upperBounds)
upperBounds
.
The partition name will be the source field name with a "_bound" suffix.
For example, range("color", "blue", "green") creates "color_bound"
partitions.sourceName
- The entity field name from which to get values to be
partitioned.upperBounds
- A variadic list of upper bounds of each partition.public PartitionStrategy.Builder year(String sourceName, @Nullable String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.public PartitionStrategy.Builder year(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.public PartitionStrategy.Builder month(String sourceName, @Nullable String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.public PartitionStrategy.Builder month(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.public PartitionStrategy.Builder day(String sourceName, @Nullable String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.public PartitionStrategy.Builder day(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.public PartitionStrategy.Builder hour(String sourceName, @Nullable String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.public PartitionStrategy.Builder hour(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.public PartitionStrategy.Builder minute(String sourceName, @Nullable String name)
sourceName
- The entity field name from which to get values to be
partitioned.name
- The entity field name of the partition.public PartitionStrategy.Builder minute(String sourceName)
sourceName
- The entity field name from which to get values to be
partitioned.public PartitionStrategy.Builder dateFormat(String sourceName, String name, String format)
sourceName
- The entity field name of the timestamp to formatname
- A name for the partitions created by the format (e.g. "day")format
- A SimpleDateFormat
format-string.public PartitionStrategy.Builder provided(String name)
The partitioner created by this method will expect String
values.
name
- A name for the partitionspublic PartitionStrategy.Builder provided(String name, @Nullable String valuesType)
The partitioner created by this method will expect values based on the
given valuesType
: "string", "int", or "long".
name
- A name for the partitionsvaluesType
- A type string for values this partitioner will expect; one of
"string", "int", or "long". If null, the default is "string".public PartitionStrategy build()
PartitionStrategy
instance.
This builder should be considered single use and discarded after a call
to this method.PartitionStrategy
.Copyright © 2013–2014. All rights reserved.