Package com.illumon.iris.db.v2.by
Class ShortChunkedSumOperator
java.lang.Object
com.illumon.iris.db.v2.by.ShortChunkedSumOperator
- All Implemented Interfaces:
IterativeChunkedAggregationOperator,ChunkSource<Attributes.Values>,FillContextMaker,GetContextMaker
public class ShortChunkedSumOperator
extends Object
implements IterativeChunkedAggregationOperator, ChunkSource<Attributes.Values>
Iterative sum operator, extended for absolute values and regular sums.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Attributes.Any>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.sources.chunk.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
ZERO_LENGTH_ITERATIVE_CHUNKED_AGGREGATION_OPERATOR_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChunk(IterativeChunkedAggregationOperator.BucketedContext context, 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 context, 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.voidfillChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> destination, OrderedKeys orderedKeys) Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.Chunk<? extends Attributes.Values>getChunk(ChunkSource.GetContext context, long firstKey, long lastKey) Same asChunkSource.getChunk(GetContext, OrderedKeys), except that you pass in the begin and last keys representing the begin and last (inclusive) keys of a single range rather than anOrderedKeys.Chunk<? extends Attributes.Values>getChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys) Returns a chunk of data corresponding to the keys from the givenOrderedKeys.Class<?>Map<String,? extends ColumnSource<?>> Return a map of result columns produced by this operator.makeFillContext(int chunkCapacity, SharedContext sharedContext) Allocate a newChunkSource.FillContextfor filling chunks from thisFillContextMaker, typically aChunkSource.makeGetContext(int chunkCapacity, SharedContext sharedContext) Allocate a newChunkSource.GetContextfor retrieving chunks from thisGetContextMaker, typically aChunkSource.voidmodifyChunk(IterativeChunkedAggregationOperator.BucketedContext context, 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.booleanmodifyChunk(IterativeChunkedAggregationOperator.SingletonContext context, 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.voidremoveChunk(IterativeChunkedAggregationOperator.BucketedContext context, 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 context, 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.sources.chunk.ChunkSource
getChunkTypeMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.FillContextMaker
makeFillContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.GetContextMaker
makeGetContextMethods inherited from interface com.illumon.iris.db.v2.by.IterativeChunkedAggregationOperator
addIndex, initializeRefreshing, makeBucketedContext, makeSingletonContext, modifyIndices, modifyIndices, propagateFailure, propagateInitialState, propagateUpdates, requiresIndices, resetForStep, shiftChunk, shiftChunk, unchunkedIndex
-
Method Details
-
addChunk
public void addChunk(IterativeChunkedAggregationOperator.BucketedContext context, 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:
context- 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 context, 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:
context- 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
-
addChunk
public boolean addChunk(IterativeChunkedAggregationOperator.SingletonContext context, 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:
context- 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 context, 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:
context- 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 void modifyChunk(IterativeChunkedAggregationOperator.BucketedContext context, 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: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:
context- 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
-
modifyChunk
public boolean modifyChunk(IterativeChunkedAggregationOperator.SingletonContext context, int chunkSize, Chunk<? extends Attributes.Values> previousValues, Chunk<? extends Attributes.Values> newValues, 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:
context- 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
-
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
-
getNativeType
- Specified by:
getNativeTypein interfaceChunkSource<Attributes.Values>
-
getChunk
public Chunk<? extends Attributes.Values> getChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSourceReturns a chunk of data corresponding to the keys from the givenOrderedKeys.- Specified by:
getChunkin interfaceChunkSource<Attributes.Values>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data poolorderedKeys- AnOrderedKeysrepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys
-
getChunk
public Chunk<? extends Attributes.Values> getChunk(@NotNull ChunkSource.GetContext context, long firstKey, long lastKey) Description copied from interface:ChunkSourceSame asChunkSource.getChunk(GetContext, OrderedKeys), except that you pass in the begin and last keys representing the begin and last (inclusive) keys of a single range rather than anOrderedKeys. Typically you want to call this only if you don't have anOrderedKeys, such as during anOrderedKeys.forAllLongRanges(LongRangeConsumer)call. In this case, it allows you to avoid creating an intermediaryOrderedKeysobject.- Specified by:
getChunkin interfaceChunkSource<Attributes.Values>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data poolfirstKey- The beginning key (inclusive) of the range to fetch in the chunklastKey- The last key (inclusive) of the range to fetch in the chunk- Returns:
- A chunk of data corresponding to the keys from the given range.
-
fillChunk
public void fillChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSourcePopulates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.- Specified by:
fillChunkin interfaceChunkSource<Attributes.Values>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according toorderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).orderedKeys- AnOrderedKeysrepresenting the keys to be fetched
-