Class DoubleRollupCountDistinctOperator
java.lang.Object
com.illumon.iris.db.v2.by.ssmcountdistinct.count.DoubleRollupCountDistinctOperator
- All Implemented Interfaces:
IterativeChunkedAggregationOperator
public class DoubleRollupCountDistinctOperator
extends Object
implements IterativeChunkedAggregationOperator
This operator counts the distinct values within the source.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
IterativeChunkedAggregationOperator.BucketedContext, IterativeChunkedAggregationOperator.SingletonContext -
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
ZERO_LENGTH_ITERATIVE_CHUNKED_AGGREGATION_OPERATOR_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Aggregate a chunk of data into the result columns.booleanaddChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, long destination) Aggregate a chunk of data into the result columns.voidensureCapacity(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.makeBucketedContext(int size) Make aIterativeChunkedAggregationOperator.BucketedContextsuitable for this operator if necessary.makeSingletonContext(int size) Make aIterativeChunkedAggregationOperator.SingletonContextsuitable for this operator if necessary.voidmodifyChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> preValues, Chunk<? extends Attributes.Values> postValues, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Modify a chunk of data previously aggregated into the result columns using a parallel chunk of new values.booleanmodifyChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> preValues, Chunk<? extends Attributes.Values> postValues, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, long destination) Modify a chunk of data previously aggregated into the result columns using a parallel chunk of new values.voidpropagateUpdates(ShiftAwareListener.Update downstream, ReadOnlyIndex newDestinations) Perform any internal state keeping needed for destinations that were added (went from 0 keys to > 0), removed (went from > 0 keys to 0), or modified (keys added or removed, or keys modified) by this iteration.voidremoveChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Remove a chunk of data previously aggregated into the result columns.booleanremoveChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, 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 com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
addIndex, initializeRefreshing, modifyIndices, modifyIndices, propagateFailure, propagateInitialState, requiresIndices, resetForStep, shiftChunk, shiftChunk, unchunkedIndex
-
Constructor Details
-
DoubleRollupCountDistinctOperator
-
-
Method Details
-
addChunk
public void addChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorAggregate a chunk of data into the result columns.- Specified by:
addChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextvalues- a chunk of values to aggregateinputIndices- the input indices, in post-shift spacedestinations- the destinations in resultColumn to aggregate into, 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 void removeChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.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.inputIndices- the input indices, 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
-
modifyChunk
public void modifyChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> preValues, Chunk<? extends Attributes.Values> postValues, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorModify a chunk of data previously aggregated into the result columns using a parallel chunk of new values. Never includes modifies that have been shifted ifIterativeChunkedAggregationOperator.requiresIndices()returns true - those are handled inIterativeChunkedAggregationOperator.shiftChunk(BucketedContext, Chunk, Chunk, LongChunk, LongChunk, IntChunk, IntChunk, IntChunk, WritableBooleanChunk).- Specified by:
modifyChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextpreValues- a chunk of values that have been previously aggregatedpostValues- a chunk of values to aggregatepostShiftIndices- the input indices, in post-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
-
addChunk
public boolean addChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, long destination) Description copied from interface:IterativeChunkedAggregationOperatorAggregate a chunk of data into the result columns.- Specified by:
addChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextchunkSize- the size of the additionvalues- the values to aggregateinputIndices- the input indices, in post-shift spacedestination- the destination in the result columns- Returns:
- true if the state was modified, false otherwise
-
removeChunk
public boolean removeChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> inputIndices, 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 aggregationinputIndices- the input indices, in pre-shift spacedestination- the destination in the result columns- Returns:
- true if the state was modified, false otherwise
-
modifyChunk
public boolean modifyChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> preValues, Chunk<? extends Attributes.Values> postValues, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, long destination) Description copied from interface:IterativeChunkedAggregationOperatorModify a chunk of data previously aggregated into the result columns using a parallel chunk of new values. Never includes modifies that have been shifted ifIterativeChunkedAggregationOperator.requiresIndices()returns true - those are handled inIterativeChunkedAggregationOperator.shiftChunk(SingletonContext, Chunk, Chunk, LongChunk, LongChunk, long).- Specified by:
modifyChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextchunkSize- the size of the modificationpreValues- a chunk of values that have been previously aggregated.postValues- a chunk of values to aggregatepostShiftIndices- the input indices, in post-shift space- Returns:
- true if the state was modified, false otherwise
-
propagateUpdates
public void propagateUpdates(@NotNull ShiftAwareListener.Update downstream, @NotNull ReadOnlyIndex newDestinations) Description copied from interface:IterativeChunkedAggregationOperatorPerform any internal state keeping needed for destinations that were added (went from 0 keys to > 0), removed (went from > 0 keys to 0), or modified (keys added or removed, or keys modified) by this iteration. Note that the arguments to this method should not be mutated in any way.- Specified by:
propagateUpdatesin interfaceIterativeChunkedAggregationOperator- Parameters:
downstream- The downstream ShiftAwareListener.Update (which does not have itsModifiedColumnSetfinalized yet)newDestinations- New destinations added on this update
-
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
-
makeBucketedContext
Description copied from interface:IterativeChunkedAggregationOperatorMake aIterativeChunkedAggregationOperator.BucketedContextsuitable for this operator if necessary.- Specified by:
makeBucketedContextin interfaceIterativeChunkedAggregationOperator- Parameters:
size- The maximum size of input chunks that will be used with the result context- Returns:
- A new
IterativeChunkedAggregationOperator.BucketedContext, or null if none is necessary
-
makeSingletonContext
Description copied from interface:IterativeChunkedAggregationOperatorMake aIterativeChunkedAggregationOperator.SingletonContextsuitable for this operator if necessary.- Specified by:
makeSingletonContextin interfaceIterativeChunkedAggregationOperator- Parameters:
size- The maximum size of input chunks that will be used with the result context- Returns:
- A new
IterativeChunkedAggregationOperator.SingletonContext, or null if none is necessary
-