Class StaticPercentileOperator
java.lang.Object
io.deephaven.engine.table.impl.by.staticpercentile.StaticPercentileOperator
- All Implemented Interfaces:
IterativeChunkedAggregationOperator
- Direct Known Subclasses:
ByteStaticPercentileOperator,CharStaticPercentileOperator,DoubleStaticPercentileOperator,FloatStaticPercentileOperator,IntStaticPercentileOperator,LongStaticPercentileOperator,ShortStaticPercentileOperator
public abstract class StaticPercentileOperator
extends Object
implements IterativeChunkedAggregationOperator
Percentile operator for static tables. Each destination accumulates its non-null values into an array; when the
initial state is propagated, an introselect finds the value at the percentile's position in each array. The arrays
are released once the results are computed.
The selected positions match SsmChunkedPercentileOperator.
With averageEvenlyDivided, the low count is (int) ((size - 1) * percentile) + 1, and when it is
exactly half of the values the result averages the low maximum with the high minimum. Otherwise the low count is
Math.round((size - 1) * percentile) + 1 and the result is the low maximum.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
IterativeChunkedAggregationOperator.BucketedContext, IterativeChunkedAggregationOperator.SingletonContext -
Field Summary
Fields inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
ZERO_LENGTH_ITERATIVE_CHUNKED_AGGREGATION_OPERATOR_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionvoidensureCapacity(long tableSize) Ensure that this operator can handle destinations up to tableSize - 1.Map<String, ? extends ColumnSource<?>> Return a map of result columns produced by this operator.make(Class<?> type, boolean equalsConsistent, double percentile, boolean averageEvenlyDivided, String name) Make a static percentile operator fortype.voidremoveChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Remove a chunk of data previously aggregated into the result columns.booleanremoveChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, long destination) Remove a chunk of data previously aggregated into the result columns.voidCalled after initialization; when the operator's result columns must have previous tracking enabled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
addChunk, addChunk, addRowSet, initializeRefreshing, makeBucketedContext, makeSingletonContext, modifyChunk, modifyChunk, modifyRowKeys, modifyRowKeys, propagateFailure, propagateInitialState, propagateUpdates, requiresRowKeys, requiresRunFinds, resetForStep, shiftChunk, shiftChunk, unchunkedRowSet
-
Method Details
-
make
public static IterativeChunkedAggregationOperator make(Class<?> type, boolean equalsConsistent, double percentile, boolean averageEvenlyDivided, String name) Make a static percentile operator fortype.- Parameters:
type- the data type of the valuesequalsConsistent- true when values of the type compare equal exactly when they are equal (seeBinarySearchKernelHelper.compareConsistentWithEquality(Class)); when false, an Object result is the first value received among those that compare equal to itpercentile- the percentile to computeaverageEvenlyDivided- seeAggSpecPercentile.averageEvenlyDivided()name- the name of the result column- Returns:
- the operator
-
removeChunk
public void removeChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorRemove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextvalues- a chunk of values that have been previously aggregated.inputRowKeys- the input row keys, in pre-shift spacedestinations- the destinations in resultColumn to remove the values from, parallel with startPositions and lengthstartPositions- the starting positions in the chunk for each destinationlength- the number of values in the chunk for each destinationstateModified- a boolean output array, parallel to destinations, which is set to true if the corresponding destination has been modified
-
removeChunk
public boolean removeChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, long destination) Description copied from interface:IterativeChunkedAggregationOperatorRemove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextchunkSize- the size of the removalvalues- the values to remove from the aggregationinputRowKeys- the input row keys, in pre-shift spacedestination- the destination in the result columns- Returns:
- true if the state was modified, false otherwise
-
ensureCapacity
public void ensureCapacity(long tableSize) Description copied from interface:IterativeChunkedAggregationOperatorEnsure that this operator can handle destinations up to tableSize - 1.- Specified by:
ensureCapacityin interfaceIterativeChunkedAggregationOperator- Parameters:
tableSize- the new size of the table
-
getResultColumns
Description copied from interface:IterativeChunkedAggregationOperatorReturn a map of result columns produced by this operator.- Specified by:
getResultColumnsin interfaceIterativeChunkedAggregationOperator- Returns:
- a map of name to columns for the result table
-
startTrackingPrevValues
public void startTrackingPrevValues()Description copied from interface:IterativeChunkedAggregationOperatorCalled after initialization; when the operator's result columns must have previous tracking enabled.- Specified by:
startTrackingPrevValuesin interfaceIterativeChunkedAggregationOperator
-