Class AbstractAsyncStateSliceWindowAggProcessor
java.lang.Object
org.apache.flink.table.runtime.operators.aggregate.window.processors.WindowAggProcessorBase<W,AsyncStateWindowProcessor.AsyncStateContext<W>>
org.apache.flink.table.runtime.operators.aggregate.asyncwindow.processors.AbstractAsyncStateWindowAggProcessor<Long>
org.apache.flink.table.runtime.operators.aggregate.asyncwindow.processors.AbstractAsyncStateSliceWindowAggProcessor
- All Implemented Interfaces:
Serializable,AsyncStateWindowProcessor<Long>,AsyncStateSlicingWindowProcessor<Long>,WindowProcessor<Long,AsyncStateWindowProcessor.AsyncStateContext<Long>>
- Direct Known Subclasses:
AsyncStateSliceSharedWindowAggProcessor,AsyncStateSliceUnsharedWindowAggProcessor
public abstract class AbstractAsyncStateSliceWindowAggProcessor
extends AbstractAsyncStateWindowAggProcessor<Long>
implements AsyncStateSlicingWindowProcessor<Long>
A base implementation of
AsyncStateSlicingWindowProcessor for window aggregate.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.table.runtime.operators.aggregate.asyncwindow.processors.AbstractAsyncStateWindowAggProcessor
AbstractAsyncStateWindowAggProcessor.WindowIsEmptyCheckerNested classes/interfaces inherited from interface org.apache.flink.table.runtime.operators.window.async.tvf.common.AsyncStateWindowProcessor
AsyncStateWindowProcessor.AsyncStateContext<W>Nested classes/interfaces inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowProcessor
WindowProcessor.Context<W> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SliceAssignerprotected AsyncStateWindowBufferprotected final AsyncStateWindowBuffer.Factoryprotected final longFields inherited from class org.apache.flink.table.runtime.operators.aggregate.asyncwindow.processors.AbstractAsyncStateWindowAggProcessor
emptyChecker, windowStateFields 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
ConstructorsConstructorDescriptionAbstractAsyncStateSliceWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler, AsyncStateWindowBuffer.Factory bufferFactory, SliceAssigner sliceAssigner, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> accSerializer, int indexOfCountStar, ZoneId shiftTimeZone) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.api.common.state.v2.StateFuture<Void>advanceProgress(org.apache.flink.table.data.RowData currentKey, 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.org.apache.flink.api.common.state.v2.StateFuture<Void>clearWindow(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>Returns the serializer of the window type.protected WindowTimerService<Long>voidInitialization method for the function.org.apache.flink.api.common.state.v2.StateFuture<Void>Performs a preparation before checkpoint.org.apache.flink.api.common.state.v2.StateFuture<Boolean>processElement(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 org.apache.flink.api.common.state.v2.StateFuture<Long>sliceStateMergeTarget(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.asyncwindow.processors.AbstractAsyncStateWindowAggProcessor
prepareAggregatorMethods inherited from class org.apache.flink.table.runtime.operators.aggregate.window.processors.WindowAggProcessorBase
collect, initializeWatermarkMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.table.runtime.operators.window.async.tvf.common.AsyncStateWindowProcessor
fireWindowMethods inherited from interface org.apache.flink.table.runtime.operators.window.tvf.common.WindowProcessor
initializeWatermark
-
Field Details
-
windowBufferFactory
-
sliceAssigner
-
windowInterval
protected final long windowInterval -
windowBuffer
-
-
Constructor Details
-
AbstractAsyncStateSliceWindowAggProcessor
public AbstractAsyncStateSliceWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler, AsyncStateWindowBuffer.Factory bufferFactory, SliceAssigner sliceAssigner, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> accSerializer, int indexOfCountStar, ZoneId shiftTimeZone)
-
-
Method Details
-
open
Description copied from interface:WindowProcessorInitialization method for the function. It is called before the actual working methods.- Specified by:
openin interfaceWindowProcessor<Long,AsyncStateWindowProcessor.AsyncStateContext<Long>> - Overrides:
openin classAbstractAsyncStateWindowAggProcessor<Long>- Throws:
Exception
-
getWindowTimerService
- Specified by:
getWindowTimerServicein classWindowAggProcessorBase<Long,AsyncStateWindowProcessor.AsyncStateContext<Long>>
-
processElement
public org.apache.flink.api.common.state.v2.StateFuture<Boolean> processElement(org.apache.flink.table.data.RowData key, org.apache.flink.table.data.RowData element) throws Exception Description copied from interface:AsyncStateWindowProcessorProcess an element with associated key from the input stream. Returns true if this element is dropped because of late arrival.- Specified by:
processElementin interfaceAsyncStateWindowProcessor<Long>- Parameters:
key- the key associated with the elementelement- The element to process.- Throws:
Exception
-
sliceStateMergeTarget
protected abstract org.apache.flink.api.common.state.v2.StateFuture<Long> sliceStateMergeTarget(long sliceToMerge) throws Exception Returns 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:
-
advanceProgress
public org.apache.flink.api.common.state.v2.StateFuture<Void> advanceProgress(org.apache.flink.table.data.RowData currentKey, long progress) throws Exception Description copied from interface:AsyncStateWindowProcessorAdvances 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.
Note: There may be multiple different keys within the buffer. When flushing them to the async state, only the async state request for the current key of the operator will be returned as a
StateFuture. Requests for async states for other keys will not be waited on.- Specified by:
advanceProgressin interfaceAsyncStateWindowProcessor<Long>- Parameters:
currentKey- the current key of the operator used to return the result of accessing async state associated with the same key. If it is null, it means that the returns of asynchronous state requests for all keys will not be awaited.progress- the current progress time- Returns:
- the future of the flush operation about current key if the current key is not null,
else a
StateFutureUtils.completedVoidFuture()will be returned. - Throws:
Exception
-
prepareCheckpoint
Description copied from interface:AsyncStateWindowProcessorPerforms a preparation before checkpoint. This usually flushes buffered data into state.- Specified by:
prepareCheckpointin interfaceAsyncStateWindowProcessor<Long>- Throws:
Exception
-
clearWindow
public org.apache.flink.api.common.state.v2.StateFuture<Void> clearWindow(long timerTimestamp, Long windowEnd) throws Exception Description copied from interface:AsyncStateWindowProcessorClear state and resources associated with the given window namespace.Note: the key context has been set.
- Specified by:
clearWindowin interfaceAsyncStateWindowProcessor<Long>- Parameters:
timerTimestamp- the fired timestampwindowEnd- the window to clear- Throws:
Exception
-
close
Description 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,AsyncStateWindowProcessor.AsyncStateContext<Long>> - Overrides:
closein classWindowAggProcessorBase<Long,AsyncStateWindowProcessor.AsyncStateContext<Long>> - Throws:
Exception
-
createWindowSerializer
Description copied from interface:WindowProcessorReturns the serializer of the window type.- Specified by:
createWindowSerializerin interfaceWindowProcessor<Long,AsyncStateWindowProcessor.AsyncStateContext<Long>>
-