public abstract class PartitionFunction<K,V>
extends java.lang.Object
implements java.io.Serializable
partition
on every tuple it generates.Modifier and Type | Field and Description |
---|---|
(package private) java.util.HashMap<K,V> |
attributes |
(package private) int |
numPartition |
private static long |
serialVersionUID |
Constructor and Description |
---|
PartitionFunction(int numPartition)
Each partition function implementation must has a Class(int) style
constructor
|
Modifier and Type | Method and Description |
---|---|
V |
getAttribute(K attribute) |
int |
numPartition() |
abstract int |
partition(Tuple t,
TupleDesc td)
Given an input tuple t, determine which partition to route it to.
|
void |
setAttribute(K attribute,
V value)
A concrete implementation of a partition function may need some
information to help it decide the tuple partitions.
|
private static final long serialVersionUID
int numPartition
public PartitionFunction(int numPartition)
public void setAttribute(K attribute, V value)
public int numPartition()
public abstract int partition(Tuple t, TupleDesc td)
t
- the input tuple to route.td
- the tuple descriptor of the input tuple. Must have non-null
names for those attributes that are used to compute the worker
to route to.