|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kitesdk.data.PartitionStrategy
@Immutable public class PartitionStrategy
The strategy used to determine how a dataset is partitioned.
A PartitionStrategy
is configured with one or more
FieldPartitioner
s upon creation. When a Dataset
is configured
with a partition strategy, we say that data is partitioned. Any entities
written to a partitioned dataset are evaluated with its
PartitionStrategy
which, in turn, produces a PartitionKey
that is used by the dataset implementation to select the proper partition.
Users should use the inner PartitionStrategy.Builder
to create new instances.
FieldPartitioner
,
PartitionKey
,
DatasetDescriptor
,
Dataset
Nested Class Summary | |
---|---|
static class |
PartitionStrategy.Builder
A fluent builder to aid in the construction of PartitionStrategy s. |
Constructor Summary | |
---|---|
PartitionStrategy(List<FieldPartitioner> partitioners)
Deprecated. will be removed in 0.12.0; use PartitionStrategy.Builder |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
int |
getCardinality()
Return the cardinality produced by the contained field partitioners. |
List<FieldPartitioner> |
getFieldPartitioners()
Get the list of field partitioners used for partitioning. |
int |
hashCode()
|
PartitionKey |
partitionKey(Object... values)
Construct a partition key with a variadic array of values corresponding to the field partitioners in this partition strategy. |
PartitionKey |
partitionKeyForEntity(Object entity)
Construct a partition key for the given entity. |
PartitionKey |
partitionKeyForEntity(Object entity,
PartitionKey reuseKey)
Construct a partition key for the given entity, reusing the supplied key if not null. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
@Deprecated public PartitionStrategy(List<FieldPartitioner> partitioners)
Method Detail |
---|
public List<FieldPartitioner> getFieldPartitioners()
Get the list of field partitioners used for partitioning.
FieldPartitioner
s are returned in the same order they are used
during partition selection.
public int getCardinality()
Return the cardinality produced by the contained field partitioners.
This can be used to aid in calculating resource usage used during certain operations. For example, when writing data to a partitioned dataset, this method can be used to estimate (or discover exactly, depending on the partition functions) how many leaf partitions exist.
Warning: This method is allowed to lie and should be treated only as a hint. Some partition functions are fixed (e.g. hash modulo number of buckets), while others are open-ended (e.g. discrete value) and depend on the input data.
public PartitionKey partitionKey(Object... values)
Construct a partition key with a variadic array of values corresponding to the field partitioners in this partition strategy.
It is permitted to have fewer values than field partitioners, in which case all subpartititions in the unspecified parts of the key are matched by the key.
Null values are not permitted.
public PartitionKey partitionKeyForEntity(Object entity)
Construct a partition key for the given entity.
This is a convenient way to find the partition that a given entity would be written to, or to find a partition using objects from the entity domain.
public PartitionKey partitionKeyForEntity(Object entity, @Nullable PartitionKey reuseKey)
Construct a partition key for the given entity, reusing the supplied key if not null.
This is a convenient way to find the partition that a given entity would be written to, or to find a partition using objects from the entity domain.
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |