Class GenericPartitionBoundaries<T>
- java.lang.Object
-
- org.apache.datasketches.quantilescommon.GenericPartitionBoundaries<T>
-
- Type Parameters:
T
- the item class type
public final class GenericPartitionBoundaries<T> extends Object
This defines the returned results of the getParitionBoundaries() function and includes the basic methods needed to construct actual partitions.
-
-
Constructor Summary
Constructors Constructor Description GenericPartitionBoundaries(long totalN, T[] boundaries, long[] natRanks, double[] normRanks, T maxItem, T minItem, QuantileSearchCriteria searchCrit)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T[]
getBoundaries()
Gets an ordered array of boundaries that sequentially define the upper and lower boundaries of partitions.T
getMaxItem()
Returns the maximum item of the stream.T
getMinItem()
Returns the minimum item of the stream.long
getN()
Gets the length of the input stream offered to the underlying sketch.long[]
getNaturalRanks()
Gets an ordered array of natural ranks of the associated array of partition boundaries utilizing a specified search criterion.double[]
getNormalizedRanks()
Gets an ordered array of normalized ranks of the associated array of partition boundaries utilizing a specified search criterion.long[]
getNumDeltaItems()
Gets the number of items to be included for each partition as an array.int
getNumPartitions()
Gets the number of partitionsQuantileSearchCriteria
getSearchCriteria()
Gets the search criteria specified for the source sketch
-
-
-
Constructor Detail
-
GenericPartitionBoundaries
public GenericPartitionBoundaries(long totalN, T[] boundaries, long[] natRanks, double[] normRanks, T maxItem, T minItem, QuantileSearchCriteria searchCrit)
Constructor.- Parameters:
totalN
- the total number of items input to the sketch.boundaries
- The quantile boundaries between partitionsnatRanks
- The array of natural Ranks corresponding to the array of boundaries.normRanks
- The normalized Ranks corresponding to the array of boundaries.maxItem
- the maximum item of the stream.minItem
- the minimum item of the stream.searchCrit
- the user defined search criteria
-
-
Method Detail
-
getN
public long getN()
Gets the length of the input stream offered to the underlying sketch.- Returns:
- the length of the input stream offered to the underlying sketch.
-
getBoundaries
public T[] getBoundaries()
Gets an ordered array of boundaries that sequentially define the upper and lower boundaries of partitions. These partitions are to be constructed by an external process. Each boundary is essentially a reference and should uniquely identify an item or a set of identical items from the original stream of data fed to the originating sketch.Assume boundaries array has size N + 1. Let the indicies be sequentially numbered from 0 to N. The number of partitions is always one less than the size of the boundaries array. Let the the partitions be sequentially numbered from 1 to N.
If these results were computed using QuantileSearchCriteria.INCLUSIVE then these sequential boundaries are to be interpreted as follows:
- Partition 1: include all items ≥ index 0 and ≤ index 1.
- Partition 2: include all items > index 1 and ≤ index 2.
- Partition N: include all items > index N-1 and ≤ index N.
If these results were computed using QuantileSearchCriteria.EXCLUSIVE then these sequential boundaries are to be interpreted as follows:
- Partition 1: include all items ≥ index 0 and < index 1.
- Partition 2: include all items ≥ index 1 and < index 2.
- Partition N: include all items ≥ index N-1 and ≤ index N.
- Returns:
- an array of boundaries that sequentially define the upper and lower boundaries of partitions.
-
getNaturalRanks
public long[] getNaturalRanks()
Gets an ordered array of natural ranks of the associated array of partition boundaries utilizing a specified search criterion. Natural ranks are integral values on the interval [1, N]- Returns:
- an array of natural ranks.
-
getNormalizedRanks
public double[] getNormalizedRanks()
Gets an ordered array of normalized ranks of the associated array of partition boundaries utilizing a specified search criterion. Normalized ranks are double values on the interval [0.0, 1.0].- Returns:
- an array of normalized ranks.
-
getNumDeltaItems
public long[] getNumDeltaItems()
Gets the number of items to be included for each partition as an array. The count at index 0 is 0. The number of items included in the first partition, defined by the boundaries at index 0 and index 1, is at index 1 in this array, etc.- Returns:
- the number of items to be included for each partition as an array.
-
getNumPartitions
public int getNumPartitions()
Gets the number of partitions- Returns:
- the number of partitions
-
getMaxItem
public T getMaxItem()
Returns the maximum item of the stream. This may be distinct from the largest item retained by the sketch algorithm.- Returns:
- the maximum item of the stream
- Throws:
IllegalArgumentException
- if sketch is empty.
-
getMinItem
public T getMinItem()
Returns the minimum item of the stream. This may be distinct from the smallest item retained by the sketch algorithm.- Returns:
- the minimum item of the stream
- Throws:
IllegalArgumentException
- if sketch is empty.
-
getSearchCriteria
public QuantileSearchCriteria getSearchCriteria()
Gets the search criteria specified for the source sketch- Returns:
- The search criteria specified for the source sketch
-
-