BinaryPartitioner (Apache Hadoop Main 3.4.1 API) (original) (raw)


@InterfaceAudience.Public
@InterfaceStability.Evolving
public class BinaryPartitioner
extends Partitioner<BinaryComparable,V>
implements Configurable
Partition BinaryComparable keys using a configurable part of the bytes array returned by BinaryComparable.getBytes().
The subarray to be used for the partitioning can be defined by means of the following properties:

  +---+---+---+---+---+  
  | B | B | B | B | B |  
  +---+---+---+---+---+  
    0   1   2   3   4  
   -5  -4  -3  -2  -1  
   

The first row of numbers gives the position of the offsets 0...5 in the array; the second row gives the corresponding negative offsets. Contrary to Python, the specified subarray has byte i and j as first and last element, repectively, when i and j are the left and right offset.
For Hadoop programs written in Java, it is advisable to use one of the following static convenience methods for setting the offsets: