Class GenericPartitionBoundaries<T>
- java.lang.Object
-
- org.apache.datasketches.quantilescommon.GenericPartitionBoundaries<T>
-
- All Implemented Interfaces:
PartitionBoundaries
public final class GenericPartitionBoundaries<T> extends Object implements PartitionBoundaries
Implements PartitionBoundaries
-
-
Constructor Summary
Constructors Constructor Description GenericPartitionBoundaries(long totalN, T[] boundaries, long[] natRanks, double[] normRanks, T maxItem, T minItem, QuantileSearchCriteria searchCrit)
-
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.TgetMaxItem()Returns the maximum item of the stream.TgetMinItem()Returns the minimum item of the stream.longgetN()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.intgetNumPartitions()Gets the number of partitionsQuantileSearchCriteriagetSearchCriteria()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)
-
-
Method Detail
-
getN
public long getN()
Description copied from interface:PartitionBoundariesGets the length of the input stream offered to the underlying sketch.- Specified by:
getNin interfacePartitionBoundaries- 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()
Description copied from interface:PartitionBoundariesGets 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]- Specified by:
getNaturalRanksin interfacePartitionBoundaries- Returns:
- an array of natural ranks.
-
getNormalizedRanks
public double[] getNormalizedRanks()
Description copied from interface:PartitionBoundariesGets 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].- Specified by:
getNormalizedRanksin interfacePartitionBoundaries- Returns:
- an array of normalized ranks.
-
getNumDeltaItems
public long[] getNumDeltaItems()
Description copied from interface:PartitionBoundariesGets 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.- Specified by:
getNumDeltaItemsin interfacePartitionBoundaries- Returns:
- the number of items to be included for each partition as an array.
-
getNumPartitions
public int getNumPartitions()
Description copied from interface:PartitionBoundariesGets the number of partitions- Specified by:
getNumPartitionsin interfacePartitionBoundaries- 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()
Description copied from interface:PartitionBoundariesGets the search criteria specified for the source sketch- Specified by:
getSearchCriteriain interfacePartitionBoundaries- Returns:
- The search criteria specified for the source sketch
-
-