Class HashPartitioner
- java.lang.Object
-
- org.apache.nemo.common.partitioner.HashPartitioner
-
- All Implemented Interfaces:
Partitioner<java.lang.Integer>
public final class HashPartitioner extends java.lang.Object implements Partitioner<java.lang.Integer>
An implementation ofPartitioner
which hashes output data from a source task according to the key of elements. The data will be hashed by their key, and applied "modulo" operation by the number of partitions.
-
-
Constructor Summary
Constructors Constructor Description HashPartitioner(int numOfPartitions, KeyExtractor keyExtractor)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
partition(java.lang.Object element)
Divides the output data from a task into multiple blocks.
-
-
-
Constructor Detail
-
HashPartitioner
public HashPartitioner(int numOfPartitions, KeyExtractor keyExtractor)
Constructor.- Parameters:
numOfPartitions
- the number of partitions.keyExtractor
- the key extractor that extracts keys from elements.
-
-
Method Detail
-
partition
public java.lang.Integer partition(java.lang.Object element)
Description copied from interface:Partitioner
Divides the output data from a task into multiple blocks.- Specified by:
partition
in interfacePartitioner<java.lang.Integer>
- Parameters:
element
- the output element from a source task.- Returns:
- the key of the partition in the block to write the element.
-
-