Class AbstractSliceSyncStateWindowAggProcessor
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.aggregate.window.processors.WindowAggProcessorBase<W,SyncStateWindowProcessor.SyncStateContext<W>>
-
- org.apache.flink.table.runtime.operators.aggregate.window.processors.AbstractSyncStateWindowAggProcessor<Long>
-
- org.apache.flink.table.runtime.operators.aggregate.window.processors.AbstractSliceSyncStateWindowAggProcessor
-
- All Implemented Interfaces:
Serializable,SyncStateWindowProcessor<Long>,WindowProcessor<Long,SyncStateWindowProcessor.SyncStateContext<Long>>,SlicingSyncStateWindowProcessor<Long>
- Direct Known Subclasses:
SliceSharedSyncStateWindowAggProcessor,SliceUnsharedSyncStateWindowAggProcessor
public abstract class AbstractSliceSyncStateWindowAggProcessor extends AbstractSyncStateWindowAggProcessor<Long> implements SlicingSyncStateWindowProcessor<Long>
A base implementation ofSlicingSyncStateWindowProcessorfor window aggregate.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.AbstractSyncStateWindowAggProcessor
AbstractSyncStateWindowAggProcessor.WindowIsEmptySupplier
-
Nested classes/interfaces inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.SyncStateWindowProcessor
SyncStateWindowProcessor.SyncStateContext<W>
-
Nested classes/interfaces inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowProcessor
WindowProcessor.Context<W>
-
-
Field Summary
Fields Modifier and Type Field Description protected SliceAssignersliceAssignerprotected WindowBufferwindowBufferprotected WindowBuffer.FactorywindowBufferFactoryprotected longwindowInterval-
Fields inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.AbstractSyncStateWindowAggProcessor
emptySupplier, windowState
-
Fields inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.WindowAggProcessorBase
accSerializer, aggregator, clockService, ctx, currentProgress, genAggsHandler, isEventTime, reuseOutput, shiftTimeZone, useDayLightSaving, windowTimerService
-
-
Constructor Summary
Constructors Constructor Description AbstractSliceSyncStateWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler, WindowBuffer.Factory bufferFactory, SliceAssigner sliceAssigner, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> accSerializer, int indexOfCountStar, ZoneId shiftTimeZone)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadvanceProgress(long progress)Advances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.voidclearWindow(long timerTimestamp, Long windowEnd)Clear state and resources associated with the given window namespace.voidclose()The tear-down method of the function.org.apache.flink.api.common.typeutils.TypeSerializer<Long>createWindowSerializer()Returns the serializer of the window type.protected WindowTimerService<Long>getWindowTimerService()voidopen(SyncStateWindowProcessor.SyncStateContext<Long> context)Initialization method for the function.voidprepareCheckpoint()Performs a preparation before checkpoint.booleanprocessElement(org.apache.flink.table.data.RowData key, org.apache.flink.table.data.RowData element)Process an element with associated key from the input stream.protected abstract longsliceStateMergeTarget(long sliceToMerge)Returns the slice state target to merge the given slice into when firing windows.-
Methods inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.AbstractSyncStateWindowAggProcessor
collect, prepareAggregator
-
Methods inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.WindowAggProcessorBase
collect, initializeWatermark
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.SyncStateWindowProcessor
fireWindow
-
Methods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowProcessor
initializeWatermark
-
-
-
-
Field Detail
-
windowBufferFactory
protected final WindowBuffer.Factory windowBufferFactory
-
sliceAssigner
protected final SliceAssigner sliceAssigner
-
windowInterval
protected final long windowInterval
-
windowBuffer
protected transient WindowBuffer windowBuffer
-
-
Constructor Detail
-
AbstractSliceSyncStateWindowAggProcessor
public AbstractSliceSyncStateWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler, WindowBuffer.Factory bufferFactory, SliceAssigner sliceAssigner, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> accSerializer, int indexOfCountStar, ZoneId shiftTimeZone)
-
-
Method Detail
-
open
public void open(SyncStateWindowProcessor.SyncStateContext<Long> context) throws Exception
Description copied from interface:WindowProcessorInitialization method for the function. It is called before the actual working methods.- Specified by:
openin interfaceWindowProcessor<Long,SyncStateWindowProcessor.SyncStateContext<Long>>- Overrides:
openin classAbstractSyncStateWindowAggProcessor<Long>- Throws:
Exception
-
getWindowTimerService
protected WindowTimerService<Long> getWindowTimerService()
- Specified by:
getWindowTimerServicein classWindowAggProcessorBase<Long,SyncStateWindowProcessor.SyncStateContext<Long>>
-
processElement
public boolean processElement(org.apache.flink.table.data.RowData key, org.apache.flink.table.data.RowData element) throws ExceptionDescription copied from interface:SyncStateWindowProcessorProcess an element with associated key from the input stream. Returns true if this element is dropped because of late arrival.- Specified by:
processElementin interfaceSyncStateWindowProcessor<Long>- Parameters:
key- the key associated with the elementelement- The element to process.- Throws:
Exception
-
sliceStateMergeTarget
protected abstract long sliceStateMergeTarget(long sliceToMerge) throws ExceptionReturns the slice state target to merge the given slice into when firing windows. For unshared windows, there should no merging happens, so the merge target should be just the givensliceToMerge. For shared windows, the merge target should be the shared slice state.- Throws:
Exception- See Also:
SliceSharedAssigner.mergeSlices(long, MergeCallback)
-
advanceProgress
public void advanceProgress(long progress) throws ExceptionDescription copied from interface:SyncStateWindowProcessorAdvances the progress time, the progress time is watermark if working in event-time mode, or current processing time if working in processing-time mode.This will potentially flush buffered data into states, because the watermark advancement may be in a very small step, but we don't need to flush buffered data for every watermark advancement.
- Specified by:
advanceProgressin interfaceSyncStateWindowProcessor<Long>- Parameters:
progress- the current progress time- Throws:
Exception
-
prepareCheckpoint
public void prepareCheckpoint() throws ExceptionDescription copied from interface:SyncStateWindowProcessorPerforms a preparation before checkpoint. This usually flushes buffered data into state.- Specified by:
prepareCheckpointin interfaceSyncStateWindowProcessor<Long>- Throws:
Exception
-
clearWindow
public void clearWindow(long timerTimestamp, Long windowEnd) throws ExceptionDescription copied from interface:SyncStateWindowProcessorClear state and resources associated with the given window namespace.Note: the key context has been set.
- Specified by:
clearWindowin interfaceSyncStateWindowProcessor<Long>- Parameters:
timerTimestamp- the fired timestampwindowEnd- the window to clear- Throws:
Exception
-
close
public void close() throws ExceptionDescription copied from interface:WindowProcessorThe tear-down method of the function. It is called after the last call to the main working methods.- Specified by:
closein interfaceWindowProcessor<Long,SyncStateWindowProcessor.SyncStateContext<Long>>- Overrides:
closein classWindowAggProcessorBase<Long,SyncStateWindowProcessor.SyncStateContext<Long>>- Throws:
Exception
-
createWindowSerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<Long> createWindowSerializer()
Description copied from interface:WindowProcessorReturns the serializer of the window type.- Specified by:
createWindowSerializerin interfaceWindowProcessor<Long,SyncStateWindowProcessor.SyncStateContext<Long>>
-
-