org.apache.hadoop.zebra.io
Class BlockDistribution

java.lang.Object
  extended by org.apache.hadoop.zebra.io.BlockDistribution

public class BlockDistribution
extends Object

Class used to convey the information of how on-disk data that fall in a specific split are distributed across hosts. This class is used by the MapReduce layer to calculate intelligent splits.

See Also:
BasicTable.Reader.getBlockDistribution(BasicTable.Reader.RangeSplit), KeyDistribution#getBlockDistribution(BytesWritable)

Constructor Summary
BlockDistribution()
           
 
Method Summary
 void add(BlockDistribution other)
          Add another block distribution to this one.
 String[] getHosts(int n)
          Get up to n hosts that own the most bytes.
 long getLength()
          Get the total number of bytes of all the blocks.
static BlockDistribution sum(BlockDistribution a, BlockDistribution b)
          Sum up two block distributions together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockDistribution

public BlockDistribution()
Method Detail

add

public void add(BlockDistribution other)
Add another block distribution to this one.

Parameters:
other - The other block distribution.

sum

public static BlockDistribution sum(BlockDistribution a,
                                    BlockDistribution b)
Sum up two block distributions together.

Parameters:
a - first block distribution
b - second block distribution
Returns:
aggregated block distribution. The input objects may no longer be held.

getLength

public long getLength()
Get the total number of bytes of all the blocks.

Returns:
total number of bytes for the blocks.

getHosts

public String[] getHosts(int n)
Get up to n hosts that own the most bytes.

Parameters:
n - targeted number of hosts.
Returns:
A list of host names (up to n).


Copyright © ${year} The Apache Software Foundation