|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.kitesdk.data.FieldPartitioner<S,T>
S - The type of the source field in the entity. The partition function must
accept values of this type.T - The type of the target field, which is the type of the return value of the
partition function.@Immutable public abstract class FieldPartitioner<S,T>
Partitions values for a named field.
Used by a PartitionStrategy to calculate which partition an entity
belongs in, based on the value of a given field, called the source field. A field
partitioner can, in some cases, provide meaningful cardinality hints to query
systems. A good example of this is a hash partitioner which always knows the number of
buckets produced by the function.
Implementations of FieldPartitioner are immutable.
PartitionStrategy| Constructor Summary | |
|---|---|
protected |
FieldPartitioner(String name,
Class<S> sourceType,
Class<T> type,
int cardinality)
|
protected |
FieldPartitioner(String sourceName,
String name,
Class<S> sourceType,
Class<T> type,
int cardinality)
|
| Method Summary | |
|---|---|
abstract T |
apply(S value)
Apply the partition function to the given value. |
int |
getCardinality()
|
String |
getName()
|
String |
getSourceName()
|
Class<S> |
getSourceType()
The type of the source field, which is the type of the type expected by the apply function. |
Class<T> |
getType()
The type of the target field, which is the type of the return value of the partition function. |
abstract com.google.common.base.Predicate<T> |
project(com.google.common.base.Predicate<S> predicate)
Projects a source-data constraint Predicate into the image of the
backing partition function. |
abstract T |
valueFromString(String stringValue)
Deprecated. will be removed in 0.12.0 |
String |
valueToString(T value)
Deprecated. will be removed in 0.12.0 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.common.base.Function |
|---|
equals |
| Methods inherited from interface java.util.Comparator |
|---|
compare, equals |
| Constructor Detail |
|---|
protected FieldPartitioner(String name,
Class<S> sourceType,
Class<T> type,
int cardinality)
protected FieldPartitioner(String sourceName,
String name,
Class<S> sourceType,
Class<T> type,
int cardinality)
| Method Detail |
|---|
public String getName()
getSourceName() and does not appear in the dataset entity.public String getSourceName()
public int getCardinality()
public abstract T apply(S value)
Apply the partition function to the given value.
The type of value must be compatible with the field partitioner implementation. Normally, this is validated at the time of initial configuration rather than at runtime.
apply in interface com.google.common.base.Function<S,T>@Deprecated public abstract T valueFromString(String stringValue)
Retrieve the value for the field from the string representation.
@Deprecated public String valueToString(T value)
Retrieve the value for the field formatted as a String. By default,
this is the object's Object.toString() representation,
but some FieldPartitioners may choose to provide a different representation.
public Class<S> getSourceType()
The type of the source field, which is the type of the type expected by the apply function.
public Class<T> getType()
The type of the target field, which is the type of the return value of the partition function.
public abstract com.google.common.base.Predicate<T> project(com.google.common.base.Predicate<S> predicate)
Predicate into the image of the
backing partition function.
If the function cannot be projected exactly, the resulting predicate must
be more permissive than the original predicate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||