|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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, that data is considered 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.
You 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. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
int |
getCardinality()
Return the cardinality produced by the contained field partitioners. |
List<org.kitesdk.data.spi.FieldPartitioner> |
getFieldPartitioners()
Get the list of field partitioners used for partitioning. |
org.kitesdk.data.spi.FieldPartitioner |
getPartitioner(String name)
Get a partitioner by partition name. |
int |
hashCode()
|
boolean |
hasPartitioner(String name)
Check if a partitioner for the partition name exists. |
PartitionKey |
partitionKey(Object... values)
Deprecated. will be removed in 0.16.0; use RefinableView
methods instead |
PartitionKey |
partitionKeyForEntity(Object entity)
Deprecated. will be removed in 0.16.0; use RefinableView
methods instead |
PartitionKey |
partitionKeyForEntity(Object entity,
PartitionKey reuseKey)
Deprecated. will be removed in 0.16.0; use RefinableView
methods instead |
String |
toString()
|
String |
toString(boolean pretty)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public List<org.kitesdk.data.spi.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 org.kitesdk.data.spi.FieldPartitioner getPartitioner(String name)
public boolean hasPartitioner(String name)
true
if this strategy has a partitioner for the namepublic int getCardinality()
Return the cardinality produced by the contained field partitioners.
This can be used to aid in calculating resource usage during certain operations. For example, when writing data to a partitioned dataset, you can use this method 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 (for example, hash modulo number of buckets), while others are open-ended (for example, discrete value) and depend on the input data.
@Deprecated public PartitionKey partitionKey(Object... values)
RefinableView
methods instead
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.
@Deprecated public PartitionKey partitionKeyForEntity(Object entity)
RefinableView
methods instead
Construct a partition key for the given entity.
This is a convenient way to find the partition that a given entity is written to, or to find a partition using objects from the entity domain.
@Deprecated public PartitionKey partitionKeyForEntity(Object entity, @Nullable PartitionKey reuseKey)
RefinableView
methods instead
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 is 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
public String toString(boolean pretty)
pretty
- true
to indent and format JSON
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |