Package com.illumon.iris.db.v2.by
Class UntrackedLastChunkedOperator
java.lang.Object
com.illumon.iris.db.v2.by.UntrackedLastChunkedOperator
- All Implemented Interfaces:
IterativeChunkedAggregationOperator
public class UntrackedLastChunkedOperator
extends Object
implements IterativeChunkedAggregationOperator
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
IterativeChunkedAggregationOperator.BucketedContext, IterativeChunkedAggregationOperator.SingletonContext
-
Field Summary
FieldsFields inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
ZERO_LENGTH_ITERATIVE_CHUNKED_AGGREGATION_OPERATOR_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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) Aggregate a chunk of data into the result columns.boolean
addChunk
(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.boolean
addIndex
(IterativeChunkedAggregationOperator.SingletonContext context, ReadOnlyIndex addIndex, long destination) void
ensureCapacity
(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.void
modifyChunk
(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, 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.boolean
modifyChunk
(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, 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.void
modifyIndices
(IterativeChunkedAggregationOperator.BucketedContext context, LongChunk<? extends Attributes.KeyIndices> inputIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Called with the modified indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true if our input columns have not changed (or we have none).boolean
modifyIndices
(IterativeChunkedAggregationOperator.SingletonContext context, LongChunk<? extends Attributes.KeyIndices> indices, long destination) Called with the modified indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true if our input columns have not changed (or we have none).void
propagateInitialState
(QueryTable resultTable) Perform any internal state keeping needed for destinations that were added during initialization.void
propagateUpdates
(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.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) Remove a chunk of data previously aggregated into the result columns.boolean
removeChunk
(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.boolean
Whether the operator requires indices.void
shiftChunk
(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, LongChunk<? extends Attributes.KeyIndices> preShiftIndices, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, IntChunk<Attributes.KeyIndices> destinations, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length, WritableBooleanChunk<Attributes.Values> stateModified) Called with shifted indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true, including shifted same-slot modifies.boolean
shiftChunk
(IterativeChunkedAggregationOperator.SingletonContext singletonContext, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, LongChunk<? extends Attributes.KeyIndices> preInputIndices, LongChunk<? extends Attributes.KeyIndices> postInputIndices, long destination) Shift a chunk of data previously aggregated into the result columns, including shifted same-slot modifies..void
Called after initialization; when the operator's result columns must have previous tracking enabled.boolean
Whether the operator can deal with an unchunked Index more efficiently than a chunked index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
initializeRefreshing, makeBucketedContext, makeSingletonContext, propagateFailure, resetForStep
-
Field Details
-
CHUNK_SIZE
-
-
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:IterativeChunkedAggregationOperator
Aggregate a chunk of data into the result columns.- Specified by:
addChunk
in 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:IterativeChunkedAggregationOperator
Remove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunk
in 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> previousValues, Chunk<? extends Attributes.Values> newValues, 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:IterativeChunkedAggregationOperator
Modify 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:
modifyChunk
in interfaceIterativeChunkedAggregationOperator
- Parameters:
bucketedContext
- the operator-specific contextpreviousValues
- a chunk of values that have been previously aggregatednewValues
- 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
-
shiftChunk
public void shiftChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, LongChunk<? extends Attributes.KeyIndices> preShiftIndices, 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:IterativeChunkedAggregationOperator
Called with shifted indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true, including shifted same-slot modifies.- Specified by:
shiftChunk
in interfaceIterativeChunkedAggregationOperator
- Parameters:
bucketedContext
- the operator-specific contextpreviousValues
- a chunk of values that have been previously aggregated.newValues
- a chunk of values to aggregatepreShiftIndices
- the input indices, in pre-shift spacepostShiftIndices
- 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
-
modifyIndices
public void modifyIndices(IterativeChunkedAggregationOperator.BucketedContext context, 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:IterativeChunkedAggregationOperator
Called with the modified indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true if our input columns have not changed (or we have none).- Specified by:
modifyIndices
in interfaceIterativeChunkedAggregationOperator
- Parameters:
context
- the operator-specific contextinputIndices
- 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
-
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:IterativeChunkedAggregationOperator
Aggregate a chunk of data into the result columns.- Specified by:
addChunk
in 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:IterativeChunkedAggregationOperator
Remove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunk
in 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> previousValues, Chunk<? extends Attributes.Values> newValues, LongChunk<? extends Attributes.KeyIndices> postShiftIndices, long destination) Description copied from interface:IterativeChunkedAggregationOperator
Modify 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:
modifyChunk
in interfaceIterativeChunkedAggregationOperator
- Parameters:
singletonContext
- the operator-specific contextchunkSize
- the size of the modificationpreviousValues
- a chunk of values that have been previously aggregated.newValues
- a chunk of values to aggregatepostShiftIndices
- the input indices, in post-shift space- Returns:
- true if the state was modified, false otherwise
-
shiftChunk
public boolean shiftChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, LongChunk<? extends Attributes.KeyIndices> preInputIndices, LongChunk<? extends Attributes.KeyIndices> postInputIndices, long destination) Description copied from interface:IterativeChunkedAggregationOperator
Shift a chunk of data previously aggregated into the result columns, including shifted same-slot modifies..- Specified by:
shiftChunk
in interfaceIterativeChunkedAggregationOperator
- Parameters:
singletonContext
- the operator-specific contextpreviousValues
- a chunk of values that have been previously aggregated.newValues
- a chunk of values to aggregatepreInputIndices
- the input indices, in pre-shift spacepostInputIndices
- the input indices, in post-shift spacedestination
- the destination in the result columns- Returns:
- true if the result should be considered modified
-
modifyIndices
public boolean modifyIndices(IterativeChunkedAggregationOperator.SingletonContext context, LongChunk<? extends Attributes.KeyIndices> indices, long destination) Description copied from interface:IterativeChunkedAggregationOperator
Called with the modified indices whenIterativeChunkedAggregationOperator.requiresIndices()
returns true if our input columns have not changed (or we have none).- Specified by:
modifyIndices
in interfaceIterativeChunkedAggregationOperator
- Parameters:
context
- the operator-specific contextindices
- the modified indices for a given destination, in post-shift spacedestination
- the destination that was modified- Returns:
- true if the result should be considered modified
-
addIndex
public boolean addIndex(IterativeChunkedAggregationOperator.SingletonContext context, ReadOnlyIndex addIndex, long destination) - Specified by:
addIndex
in interfaceIterativeChunkedAggregationOperator
-
unchunkedIndex
public boolean unchunkedIndex()Description copied from interface:IterativeChunkedAggregationOperator
Whether the operator can deal with an unchunked Index more efficiently than a chunked index.- Specified by:
unchunkedIndex
in interfaceIterativeChunkedAggregationOperator
- Returns:
- true if the operator can deal with unchunked indices, false otherwise
-
ensureCapacity
public void ensureCapacity(long tableSize) Description copied from interface:IterativeChunkedAggregationOperator
Ensure that this operator can handle destinations up to tableSize - 1.- Specified by:
ensureCapacity
in interfaceIterativeChunkedAggregationOperator
- Parameters:
tableSize
- the new size of the table
-
getResultColumns
Description copied from interface:IterativeChunkedAggregationOperator
Return a map of result columns produced by this operator.- Specified by:
getResultColumns
in interfaceIterativeChunkedAggregationOperator
- Returns:
- a map of name to columns for the result table
-
startTrackingPrevValues
public void startTrackingPrevValues()Description copied from interface:IterativeChunkedAggregationOperator
Called after initialization; when the operator's result columns must have previous tracking enabled.- Specified by:
startTrackingPrevValues
in interfaceIterativeChunkedAggregationOperator
-
requiresIndices
public boolean requiresIndices()Description copied from interface:IterativeChunkedAggregationOperator
Whether the operator requires indices. This implies that the operator must process shifts (i.e.IterativeChunkedAggregationOperator.shiftChunk(com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator.BucketedContext, com.illumon.iris.db.v2.sources.chunk.Chunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.Values>, com.illumon.iris.db.v2.sources.chunk.Chunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.Values>, com.illumon.iris.db.v2.sources.chunk.LongChunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.KeyIndices>, com.illumon.iris.db.v2.sources.chunk.LongChunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.KeyIndices>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.KeyIndices>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.ChunkPositions>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.ChunkLengths>, com.illumon.iris.db.v2.sources.chunk.WritableBooleanChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.Values>)
), and must observe modifications even when its input columns (if any) are not modified (i.e.IterativeChunkedAggregationOperator.modifyIndices(com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator.BucketedContext, com.illumon.iris.db.v2.sources.chunk.LongChunk<? extends com.illumon.iris.db.v2.sources.chunk.Attributes.KeyIndices>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.KeyIndices>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.ChunkPositions>, com.illumon.iris.db.v2.sources.chunk.IntChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.ChunkLengths>, com.illumon.iris.db.v2.sources.chunk.WritableBooleanChunk<com.illumon.iris.db.v2.sources.chunk.Attributes.Values>)
).- Specified by:
requiresIndices
in interfaceIterativeChunkedAggregationOperator
- Returns:
- true if the operator requires indices, false otherwise
-
propagateInitialState
Description copied from interface:IterativeChunkedAggregationOperator
Perform any internal state keeping needed for destinations that were added during initialization.- Specified by:
propagateInitialState
in interfaceIterativeChunkedAggregationOperator
- Parameters:
resultTable
- The resultQueryTable
after initialization
-
propagateUpdates
public void propagateUpdates(@NotNull ShiftAwareListener.Update downstream, @NotNull ReadOnlyIndex newDestinations) Description copied from interface:IterativeChunkedAggregationOperator
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. Note that the arguments to this method should not be mutated in any way.- Specified by:
propagateUpdates
in interfaceIterativeChunkedAggregationOperator
- Parameters:
downstream
- The downstream ShiftAwareListener.Update (which does not have itsModifiedColumnSet
finalized yet)newDestinations
- New destinations added on this update
-