org.apache.hadoop.mapreduce.lib.partition

## Class RehashPartitioner<K,V>

- java.lang.Object
- - org.apache.hadoop.mapreduce.Partitioner<K,V>
  - - org.apache.hadoop.mapreduce.lib.partition.RehashPartitioner<K,V>

-     @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class RehashPartitioner<K,V>
      extends Partitioner<K,V>

  This partitioner rehashes values returned by `Object.hashCode()` to get smoother distribution between partitions which may improve reduce reduce time in some cases and should harm things in no cases. This partitioner is suggested with Integer and Long keys with simple patterns in their distributions.
  Since:
    2.0.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RehashPartitioner()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getPartition(K key, V value, int numReduceTasks)` Rehash `Object.hashCode()` to partition.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RehashPartitioner

          public RehashPartitioner()

  - ### Method Detail

    - #### getPartition

          public int getPartition(K key,
                                  V value,
                                  int numReduceTasks)

      Rehash `Object.hashCode()` to partition.
      Specified by:
        `getPartition` in class `Partitioner<K,V>`
      Parameters:
        `key` - the key to be partioned.
        `value` - the entry value.
        `numReduceTasks` - the total number of partitions.
      Returns:
        the partition number for the `key`.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.