Package com.illumon.iris.db.v2.updateby
Interface ChunkedUpdateByOperator
- All Known Implementing Classes:
AbstractStaticUpdateByOperator,BaseDynamicFillByOperator,BaseObjectBinaryStaticOperator,BaseStaticEMAOperator,BigDecimalStaticCumProdOperator,BigDecimalStaticCumSumOperator,BigDecimalStaticEMAOperator,BigIntegerStaticCumProdOperator,BigIntegerStaticCumSumOperator,BigIntegerStaticEMAOperator,BigNumberStaticEMAOperator,BooleanChunkedFillByOperator,BooleanStaticChunkedFillByOperator,BooleanStaticCumSumOperator,ByteChunkedFillByOperator,ByteStaticChunkedFillByOperator,ByteStaticCumMinMaxOperator,ByteStaticCumProdOperator,ByteStaticCumSumOperator,ByteStaticEMAOperator,CharChunkedFillByOperator,CharStaticChunkedFillByOperator,ComparableStaticCumMinMaxOperator,DoubleChunkedFillByOperator,DoubleStaticChunkedFillByOperator,DoubleStaticCumMinMaxOperator,DoubleStaticCumProdOperator,DoubleStaticCumSumOperator,DoubleStaticEMAOperator,FloatChunkedFillByOperator,FloatStaticChunkedFillByOperator,FloatStaticCumMinMaxOperator,FloatStaticCumProdOperator,FloatStaticCumSumOperator,FloatStaticEMAOperator,IntChunkedFillByOperator,IntegerStaticCumMinMaxOperator,IntegerStaticCumProdOperator,IntegerStaticCumSumOperator,IntegerStaticEMAOperator,IntStaticChunkedFillByOperator,LongChunkedFillByOperator,LongRecordingUpdateByOperator,LongStaticChunkedFillByOperator,LongStaticCumMinMaxOperator,LongStaticCumProdOperator,LongStaticCumSumOperator,LongStaticEMAOperator,ObjectChunkedFillByOperator,ObjectStaticChunkedFillByOperator,ShortChunkedFillByOperator,ShortStaticChunkedFillByOperator,ShortStaticCumMinMaxOperator,ShortStaticCumProdOperator,ShortStaticCumSumOperator,ShortStaticEMAOperator
public interface ChunkedUpdateByOperator
An operator that performs a specific computation for
Table.updateBy(java.util.Collection<com.illumon.iris.db.v2.updateby.UpdateByClause>, com.illumon.iris.db.tables.select.MatchPair...). When adding implementations
of this interface, the pattern of calls will be as follows.
Additionally, implementations are responsible for notifying the update model if any rows
have been modified beyond what was passed through in the upstream update via the
anyModified(UpdateContext) and getAdditionalModifications(UpdateContext) methods
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceChunkedUpdateByOperator.BucketedUpdateContextA context item for use withTable.updateBy(Collection, MatchPair...)for bucketed updates.static interfaceChunkedUpdateByOperator.UpdateContextA context item for use withTable.updateBy(Collection, MatchPair...)for non-bucketed updates. -
Field Summary
Fields Modifier and Type Field Description static ChunkedUpdateByOperator[]ZERO_LENGTH_OP_ARRAY -
Method Summary
Modifier and Type Method Description voidaddChunk(ChunkedUpdateByOperator.BucketedUpdateContext context, Chunk<Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> keyChunk, IntChunk<Attributes.KeyIndices> bucketPositions, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> length)Add a chunk of bucketed items to the operation.voidaddChunk(ChunkedUpdateByOperator.UpdateContext updateContext, LongChunk<Attributes.OrderedKeyIndices> keyChunk, Chunk<Attributes.Values> workingChunk, long groupPosition)Add a chunk of non-bucketed items to the operation.booleananyModified(ChunkedUpdateByOperator.BucketedUpdateContext ctx)Check if the update has modified any rows for this operator.booleananyModified(ChunkedUpdateByOperator.UpdateContext ctx)Check if the update has modified any rows for this operator.voidapplyShift(ChunkedUpdateByOperator.UpdateContext updateContext, ReadOnlyIndex prevIndex, IndexShiftData shifted)Apply a shift to the operation.voidfinishFor(ChunkedUpdateByOperator.BucketedUpdateContext updateContext, UpdateBy.UpdateType type)Perform and bookkeeping required at the end of a single part of the update.voidfinishFor(ChunkedUpdateByOperator.UpdateContext updateContext, UpdateBy.UpdateType type)Perform and bookkeeping required at the end of a single part of the update.ReadOnlyIndexgetAdditionalModifications(ChunkedUpdateByOperator.UpdateContext ctx)Get an index of rows that were modified beyond the input set of modifications from the upstream.StringgetInputColumnName()Get the name of the input column this operator depends on.String[]getOutputColumnNames()Get an array of the output column names.Map<String,ColumnSource<?>>getOutputColumns()Get a map of outputName to outputColumnSourcefor this operation.voidinitializeFor(ChunkedUpdateByOperator.BucketedUpdateContext updateContext, UpdateBy.UpdateType type, ReadOnlyIndex updateIndex)Initialize the context for the specified stage of the update process.voidinitializeFor(ChunkedUpdateByOperator.UpdateContext updateContext, UpdateBy.UpdateType type, ReadOnlyIndex updateIndex)Initialize the context for the specified stage of the update process.ChunkedUpdateByOperator.BucketedUpdateContextmakeBucketedContext(int chunkSize)Make anChunkedUpdateByOperator.UpdateContextsuitable for use with bucketed updates.ChunkedUpdateByOperator.UpdateContextmakeUpdateContext(int chunkSize)Make anChunkedUpdateByOperator.UpdateContextsuitable for use with non-bucketed updates.voidmodifyChunk(ChunkedUpdateByOperator.UpdateContext updateContext, LongChunk<Attributes.OrderedKeyIndices> prevKeyChunk, LongChunk<Attributes.OrderedKeyIndices> keyChunk, Chunk<Attributes.Values> prevWorkingChunk, Chunk<Attributes.Values> postWorkingChunk, long groupPosition)Modify a chunk of values with the operation.voidremoveChunk(ChunkedUpdateByOperator.UpdateContext updateContext, LongChunk<Attributes.OrderedKeyIndices> keyChunk, Chunk<Attributes.Values> prevWorkingChunk, long groupPosition)Remove a chunk of values from the operation.voidsetBucketCapacity(int capacity)Notify the operator of the current maximum bucket.voidsetUpstream(ChunkedUpdateByOperator.BucketedUpdateContext ctx, ShiftAwareListener.Update upstream)Set theupstreamupdate object for this update cycle.voidsetUpstream(ChunkedUpdateByOperator.UpdateContext ctx, ShiftAwareListener.Update upstream)Set theupstreamupdate object for this update cycle.voidstartTrackingPrev()Indicate that the operation should start tracking previous values for ticking updates.
-
Field Details
-
Method Details
-
setBucketCapacity
void setBucketCapacity(int capacity)Notify the operator of the current maximum bucket.- Parameters:
capacity- the capacity
-
getInputColumnName
Get the name of the input column this operator depends on.- Returns:
- the name of the input column
-
getOutputColumnNames
Get an array of the output column names.- Returns:
- the output column names.
-
getOutputColumns
Get a map of outputName to outputColumnSourcefor this operation.- Returns:
- a map of output column name to output column source
-
startTrackingPrev
void startTrackingPrev()Indicate that the operation should start tracking previous values for ticking updates. -
makeUpdateContext
Make anChunkedUpdateByOperator.UpdateContextsuitable for use with non-bucketed updates.- Parameters:
chunkSize- The expected size of chunks that will be provided during the update,- Returns:
- a new updateContext
-
makeBucketedContext
Make anChunkedUpdateByOperator.UpdateContextsuitable for use with bucketed updates.- Parameters:
chunkSize- The expected size of chunks that will be provided during the update,- Returns:
- a new updateContext
-
initializeFor
void initializeFor(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull UpdateBy.UpdateType type, @NotNull ReadOnlyIndex updateIndex)Initialize the context for the specified stage of the update process. This will always be followed by a call to
finishFor(UpdateContext, UpdateBy.UpdateType)at the end of each successful update.- Parameters:
updateContext- the context objecttype- the type of update being appliedupdateIndex- the index of rows associated with the update.
-
initializeFor
void initializeFor(@NotNull ChunkedUpdateByOperator.BucketedUpdateContext updateContext, @NotNull UpdateBy.UpdateType type, @NotNull ReadOnlyIndex updateIndex)Initialize the context for the specified stage of the update process. This will always be followed by a call to
finishFor(UpdateContext, UpdateBy.UpdateType)at the end of each successful update.- Parameters:
updateContext- the context objecttype- the type of update being appliedupdateIndex- the index of rows associated with the update.
-
finishFor
void finishFor(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull UpdateBy.UpdateType type)Perform and bookkeeping required at the end of a single part of the update. This is always preceded with a call toinitializeFor(UpdateContext, UpdateBy.UpdateType, ReadOnlyIndex)- Parameters:
updateContext- the context objecttype- the type of update being applied
-
finishFor
void finishFor(@NotNull ChunkedUpdateByOperator.BucketedUpdateContext updateContext, @NotNull UpdateBy.UpdateType type)Perform and bookkeeping required at the end of a single part of the update. This is always preceded with a call toinitializeFor(UpdateContext, UpdateBy.UpdateType, ReadOnlyIndex)- Parameters:
updateContext- the context objecttype- the type of update being applied
-
addChunk
void addChunk(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull LongChunk<Attributes.OrderedKeyIndices> keyChunk, @NotNull Chunk<Attributes.Values> workingChunk, long groupPosition)Add a chunk of non-bucketed items to the operation.- Parameters:
updateContext- the context objectkeyChunk- a chunk of keys for the rows being addedworkingChunk- the chunk of values for the rows being addedgroupPosition- the group position
-
addChunk
void addChunk(@NotNull ChunkedUpdateByOperator.BucketedUpdateContext context, @NotNull Chunk<Attributes.Values> values, @NotNull LongChunk<? extends Attributes.KeyIndices> keyChunk, @NotNull IntChunk<Attributes.KeyIndices> bucketPositions, @NotNull IntChunk<Attributes.ChunkPositions> startPositions, @NotNull IntChunk<Attributes.ChunkLengths> length)Add a chunk of bucketed items to the operation.- Parameters:
context- the context objectvalues- the value chunkkeyChunk- a chunk of keys for the rows being addedbucketPositions- a chunk of hash bucket positions for each keylength- the length of each run of bucket valuesstartPositions- the start position of a run within the chunk
-
modifyChunk
void modifyChunk(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull LongChunk<Attributes.OrderedKeyIndices> prevKeyChunk, @NotNull LongChunk<Attributes.OrderedKeyIndices> keyChunk, @NotNull Chunk<Attributes.Values> prevWorkingChunk, @NotNull Chunk<Attributes.Values> postWorkingChunk, long groupPosition)Modify a chunk of values with the operation.- Parameters:
updateContext- the context objectprevKeyChunk- a chunk of pre-shift keys. This will be equal tokeyChunkif no shift is presentkeyChunk- a chunk of post-shift space keys for the update.prevWorkingChunk- a chunk of previous values for the updatepostWorkingChunk- a chunk of current values for the updategroupPosition-
-
removeChunk
void removeChunk(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull LongChunk<Attributes.OrderedKeyIndices> keyChunk, @NotNull Chunk<Attributes.Values> prevWorkingChunk, long groupPosition)Remove a chunk of values from the operation.- Parameters:
updateContext- the context objectkeyChunk- a chunk of keys being removed.prevWorkingChunk- the chunk of values being removedgroupPosition-
-
applyShift
void applyShift(@NotNull ChunkedUpdateByOperator.UpdateContext updateContext, @NotNull ReadOnlyIndex prevIndex, @NotNull IndexShiftData shifted)Apply a shift to the operation.- Parameters:
updateContext- the context objectprevIndex- the pre-shifted indexshifted- the shifts being applied
-
setUpstream
void setUpstream(@NotNull ChunkedUpdateByOperator.UpdateContext ctx, @NotNull ShiftAwareListener.Update upstream)Set theupstreamupdate object for this update cycle.- Parameters:
ctx- the context objectupstream- the upstream update
-
setUpstream
void setUpstream(@NotNull ChunkedUpdateByOperator.BucketedUpdateContext ctx, @NotNull ShiftAwareListener.Update upstream)Set theupstreamupdate object for this update cycle.- Parameters:
ctx- the context objectupstream- the upstream update
-
getAdditionalModifications
@NotNull ReadOnlyIndex getAdditionalModifications(@NotNull ChunkedUpdateByOperator.UpdateContext ctx)Get an index of rows that were modified beyond the input set of modifications from the upstream. This is invoked once at the end of a complete update cycle (that is, after all adds, removes, modifies and shifts have been processed) ifanyModified(UpdateContext)has returned true.- Parameters:
ctx- the context object- Returns:
- a
indexof additional rows that were modified
-
anyModified
Check if the update has modified any rows for this operator. This is invoked once at the end of a complete update cycle (that is, after all adds, removes, modifies and shifts have been processed).- Parameters:
ctx- the context object- Returns:
- true if the update modified any rows.
-
anyModified
Check if the update has modified any rows for this operator. This is invoked once at the end of a complete update cycle (that is, after all adds, removes, modifies and shifts have been processed).- Parameters:
ctx- the context object- Returns:
- true if the update modified any rows.
-