public class SimpleIntegerDistribution extends SimpleDistribution
boundaries, dim| Constructor and Description |
|---|
SimpleIntegerDistribution() |
SimpleIntegerDistribution(int[] bucketBoundaries) |
SimpleIntegerDistribution(IntValue[] bucketBoundaries) |
SimpleIntegerDistribution(IntValue[][] bucketBoundaries) |
| Modifier and Type | Method and Description |
|---|---|
IntValue[] |
getBucketBoundary(int bucketNum,
int totalNumBuckets)
Returns the i'th bucket's upper bound, given that the distribution is to be
split into
totalBuckets buckets. |
int |
getNumberOfFields()
The number of fields in the (composite) key.
|
void |
read(DataInputView in)
Reads the object's internal data from the given data input view.
|
void |
write(DataOutputView out)
Writes the object's internal data to the given data output view.
|
public SimpleIntegerDistribution()
public SimpleIntegerDistribution(int[] bucketBoundaries)
public SimpleIntegerDistribution(IntValue[] bucketBoundaries)
public SimpleIntegerDistribution(IntValue[][] bucketBoundaries)
public int getNumberOfFields()
DataDistributionDataDistribution.getBucketBoundary(int, int).getNumberOfFields in interface DataDistributiongetNumberOfFields in class SimpleDistributionpublic IntValue[] getBucketBoundary(int bucketNum, int totalNumBuckets)
DataDistributiontotalBuckets buckets.
Assuming n buckets, let B_i be the result from calling getBucketBoundary(i, n),
then the distribution will partition the data domain in the following fashion:
(-inf, B_1] (B_1, B_2] ... (B_n-2, B_n-1] (B_n-1, inf)
Note: The last bucket's upper bound is actually discarded by many algorithms.
The last bucket is assumed to hold all values v such that
v > getBucketBoundary(n-1, n), where n is the number of buckets.
getBucketBoundary in interface DataDistributiongetBucketBoundary in class SimpleDistributionbucketNum - The number of the bucket for which to get the upper bound.totalNumBuckets - The number of buckets to split the data into.public void write(DataOutputView out) throws IOException
IOReadableWritablewrite in interface IOReadableWritablewrite in class SimpleDistributionout - the output view to receive the data.IOException - thrown if any error occurs while writing to the output streampublic void read(DataInputView in) throws IOException
IOReadableWritableread in interface IOReadableWritableread in class SimpleDistributionin - the input view to read the data fromIOException - thrown if any error occurs while reading from the input streamCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.