Class BigNumberEMAOperator<T>
java.lang.Object
com.illumon.iris.db.v2.updateby.internal.BaseObjectUpdateByOperator<BigDecimal>
com.illumon.iris.db.v2.updateby.ema.BigNumberEMAOperator<T>
- All Implemented Interfaces:
UpdateByOperator
- Direct Known Subclasses:
BigDecimalEMAOperator,BigIntegerEMAOperator
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.updateby.internal.BaseObjectUpdateByOperator
BaseObjectUpdateByOperator.ContextNested classes/interfaces inherited from interface com.illumon.iris.db.v2.updateby.UpdateByOperator
UpdateByOperator.UpdateContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EmaControlprotected final LongRecordingUpdateByOperatorprotected final doubleprotected final ColumnSource<T>Fields inherited from class com.illumon.iris.db.v2.updateby.internal.BaseObjectUpdateByOperator
affectingColumns, bucketLastVal, initialized, isRedirected, maybeInnerSource, outputSource, pair, singletonValFields inherited from interface com.illumon.iris.db.v2.updateby.UpdateByOperator
ZERO_LENGTH_OP_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionBigNumberEMAOperator(MatchPair pair, String[] affectingColumns, EmaControl control, LongRecordingUpdateByOperator timeRecorder, long timeScaleUnits, ColumnSource<T> valueSource, RedirectionIndex redirectionIndex) An operator that computes an EMA from a int column using an exponential decay function. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChunk(UpdateByOperator.UpdateContext context, Chunk<Attributes.Values> values, LongChunk<? extends Attributes.KeyIndices> keyChunk, IntChunk<Attributes.KeyIndices> bucketPositions, IntChunk<Attributes.ChunkPositions> startPositions, IntChunk<Attributes.ChunkLengths> runLengths) Add a chunk of bucketed items to the operation.protected voiddoAddChunk(BaseObjectUpdateByOperator<BigDecimal>.Context updateContext, OrderedKeys inputKeys, Chunk<Attributes.Values> workingChunk, long groupPosition) Add a chunk of values to the operator.voidinitializeFor(UpdateByOperator.UpdateContext updateContext, ReadOnlyIndex updateIndex, UpdateBy.UpdateType type) Initialize the context for the specified stage of the update process.voidinitializeForUpdate(UpdateByOperator.UpdateContext context, ShiftAwareListener.Update upstream, ReadOnlyIndex resultSourceIndex, boolean usingBuckets, boolean isAppendOnly) Initialize the operator for an update cycle.makeUpdateContext(int chunkSize) Make anUpdateByOperator.UpdateContextsuitable for use with non-bucketed updates.voidresetForReprocess(UpdateByOperator.UpdateContext context, ReadOnlyIndex sourceIndex, ColumnSource<?> inputSource, long firstUnmodifiedKey) Reset the operator to the state at the `firstModifiedKey` for non-bucketed operation.voidresetForReprocess(UpdateByOperator.UpdateContext ctx, ReadOnlyIndex bucketIndex, ColumnSource<?> inputSource, long bucketPosition, long firstUnmodifiedKey) Reset the operator to the state at the `firstModifiedKey` for the specified bucket.voidsetBucketCapacity(int capacity) Notify the operator of the current maximum bucket.Methods inherited from class com.illumon.iris.db.v2.updateby.internal.BaseObjectUpdateByOperator
addChunk, anyModified, applyOutputShift, applyShift, canProcessNormalUpdate, finishFor, getAdditionalModifications, getAffectingColumnNames, getInputColumnName, getOutputColumnNames, getOutputColumns, modifyChunk, onBucketsRemoved, removeChunk, reprocessChunk, reprocessChunk, requiresKeys, requiresValues, setChunkSize, startTrackingPrev
-
Field Details
-
valueSource
-
control
-
timeRecorder
-
timeScaleUnits
protected final double timeScaleUnits
-
-
Constructor Details
-
BigNumberEMAOperator
public BigNumberEMAOperator(@NotNull MatchPair pair, @NotNull String[] affectingColumns, @NotNull EmaControl control, @Nullable LongRecordingUpdateByOperator timeRecorder, long timeScaleUnits, @NotNull ColumnSource<T> valueSource, @Nullable RedirectionIndex redirectionIndex) An operator that computes an EMA from a int column using an exponential decay function.- Parameters:
pair- theMatchPairthat defines the input/output for this operationaffectingColumns- the names of the columns that affect this emacontrol- defines how to handlenullinput values.timeRecorder- an optional recorder for a timestamp column. If this is null, it will be assumed time is measured in integer ticks.timeScaleUnits- the smoothing window for the EMA. If notimeRecorderis provided, this is measuredvalueSource- the input column source. Used when determining reset positions for reprocessing
-
-
Method Details
-
setBucketCapacity
public void setBucketCapacity(int capacity) Description copied from interface:UpdateByOperatorNotify the operator of the current maximum bucket.- Specified by:
setBucketCapacityin interfaceUpdateByOperator- Overrides:
setBucketCapacityin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
capacity- the capacity
-
makeUpdateContext
Description copied from interface:UpdateByOperatorMake anUpdateByOperator.UpdateContextsuitable for use with non-bucketed updates.- Specified by:
makeUpdateContextin interfaceUpdateByOperator- Overrides:
makeUpdateContextin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
chunkSize- The expected size of chunks that will be provided during the update,- Returns:
- a new context
-
initializeForUpdate
public void initializeForUpdate(@NotNull UpdateByOperator.UpdateContext context, @NotNull ShiftAwareListener.Update upstream, @NotNull ReadOnlyIndex resultSourceIndex, boolean usingBuckets, boolean isAppendOnly) Description copied from interface:UpdateByOperatorInitialize the operator for an update cycle. This is invoked before any other update processing occurs.- Specified by:
initializeForUpdatein interfaceUpdateByOperator- Overrides:
initializeForUpdatein classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
context- the context objectupstream- the upstream update to processresultSourceIndex- the result index of the source tableusingBuckets- if the update is bucketed or notisAppendOnly- if the upstream update was detected to be append-only.
-
initializeFor
public void initializeFor(@NotNull UpdateByOperator.UpdateContext updateContext, @NotNull ReadOnlyIndex updateIndex, @NotNull UpdateBy.UpdateType type) Description copied from interface:UpdateByOperatorInitialize the context for the specified stage of the update process. This will always be followed by a call to
UpdateByOperator.finishFor(UpdateContext, UpdateType)at the end of each successful update.- Specified by:
initializeForin interfaceUpdateByOperator- Overrides:
initializeForin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
updateContext- the context objectupdateIndex- the index of rows associated with the update.type- the type of update being applied
-
doAddChunk
protected void doAddChunk(@NotNull BaseObjectUpdateByOperator<BigDecimal>.Context updateContext, @NotNull OrderedKeys inputKeys, @NotNull Chunk<Attributes.Values> workingChunk, long groupPosition) Description copied from class:BaseObjectUpdateByOperatorAdd a chunk of values to the operator.- Specified by:
doAddChunkin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
updateContext- the context objectinputKeys- the input keys for the chunkworkingChunk- the chunk of valuesgroupPosition- the bucket position that the values belong to.
-
addChunk
public void addChunk(@NotNull UpdateByOperator.UpdateContext 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> runLengths) Description copied from interface:UpdateByOperatorAdd 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 keystartPositions- the start position of a run within the chunkrunLengths- the runLengths of each run of bucket values
-
resetForReprocess
public void resetForReprocess(@NotNull UpdateByOperator.UpdateContext context, @NotNull ReadOnlyIndex sourceIndex, @NotNull ColumnSource<?> inputSource, long firstUnmodifiedKey) Description copied from interface:UpdateByOperatorReset the operator to the state at the `firstModifiedKey` for non-bucketed operation. This is invoked immediately prior to calls toUpdateByOperator.reprocessChunk(UpdateContext, OrderedKeys, LongChunk, Chunk, ReadOnlyIndex).
A `firstUnmodifiedKey` ofReadOnlyIndex.NULL_KEYindicates that the entire table needs to be recomputed.- Specified by:
resetForReprocessin interfaceUpdateByOperator- Overrides:
resetForReprocessin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
context- the context objectsourceIndex- the current index of the source tableinputSource- the most primitive form of the input column sourcefirstUnmodifiedKey- the first unmodified key after which we will reprocess rows.
-
resetForReprocess
public void resetForReprocess(@NotNull UpdateByOperator.UpdateContext ctx, @NotNull ReadOnlyIndex bucketIndex, @NotNull ColumnSource<?> inputSource, long bucketPosition, long firstUnmodifiedKey) Description copied from interface:UpdateByOperatorReset the operator to the state at the `firstModifiedKey` for the specified bucket. This is invoked immediately prior to calls toUpdateByOperator.reprocessChunk(UpdateContext, OrderedKeys, Chunk, LongChunk, IntChunk, IntChunk, IntChunk).- Specified by:
resetForReprocessin interfaceUpdateByOperator- Overrides:
resetForReprocessin classBaseObjectUpdateByOperator<BigDecimal>- Parameters:
ctx- the context objectbucketIndex- the current index of the specified bucketinputSource- the most primitive form of the input column sourcefirstUnmodifiedKey- the first unmodified key in the bucket after which we will reprocess rows.
-