public abstract class AbstractSliceWindowAggProcessor extends AbstractWindowAggProcessor<Long> implements SlicingWindowProcessor<Long>
SlicingWindowProcessor
for window aggregate.AbstractWindowAggProcessor.WindowIsEmptySupplier
WindowProcessor.Context<W>
Modifier and Type | Field and Description |
---|---|
protected SliceAssigner |
sliceAssigner |
protected WindowBuffer |
windowBuffer |
protected WindowBuffer.Factory |
windowBufferFactory |
protected long |
windowInterval |
accSerializer, aggregator, clockService, ctx, currentProgress, emptySupplier, genAggsHandler, isEventTime, reuseOutput, shiftTimeZone, useDayLightSaving, windowState, windowTimerService
Constructor and Description |
---|
AbstractSliceWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler,
WindowBuffer.Factory bufferFactory,
SliceAssigner sliceAssigner,
TypeSerializer<RowData> accSerializer,
int indexOfCountStar,
ZoneId shiftTimeZone) |
Modifier and Type | Method and Description |
---|---|
void |
advanceProgress(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.
|
void |
clearWindow(long timerTimestamp,
Long windowEnd)
Clear state and resources associated with the given window namespace.
|
void |
close()
The tear-down method of the function.
|
TypeSerializer<Long> |
createWindowSerializer()
Returns the serializer of the window type.
|
protected WindowTimerService<Long> |
getWindowTimerService() |
void |
open(WindowProcessor.Context<Long> context)
Initialization method for the function.
|
void |
prepareCheckpoint()
Performs a preparation before checkpoint.
|
boolean |
processElement(RowData key,
RowData element)
Process an element with associated key from the input stream.
|
protected abstract long |
sliceStateMergeTarget(long sliceToMerge)
Returns the slice state target to merge the given slice into when firing windows.
|
collect, initializeWatermark
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fireWindow, initializeWatermark
protected final WindowBuffer.Factory windowBufferFactory
protected final SliceAssigner sliceAssigner
protected final long windowInterval
protected transient WindowBuffer windowBuffer
public AbstractSliceWindowAggProcessor(GeneratedNamespaceAggsHandleFunction<Long> genAggsHandler, WindowBuffer.Factory bufferFactory, SliceAssigner sliceAssigner, TypeSerializer<RowData> accSerializer, int indexOfCountStar, ZoneId shiftTimeZone)
public void open(WindowProcessor.Context<Long> context) throws Exception
WindowProcessor
open
in interface WindowProcessor<Long>
open
in class AbstractWindowAggProcessor<Long>
Exception
protected WindowTimerService<Long> getWindowTimerService()
getWindowTimerService
in class AbstractWindowAggProcessor<Long>
public boolean processElement(RowData key, RowData element) throws Exception
WindowProcessor
processElement
in interface WindowProcessor<Long>
key
- the key associated with the elementelement
- The element to process.Exception
protected abstract long sliceStateMergeTarget(long sliceToMerge) throws Exception
sliceToMerge
. For shared windows, the merge target should be the shared slice
state.Exception
SliceSharedAssigner.mergeSlices(long, MergeCallback)
public void advanceProgress(long progress) throws Exception
WindowProcessor
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.
advanceProgress
in interface WindowProcessor<Long>
progress
- the current progress timeException
public void prepareCheckpoint() throws Exception
WindowProcessor
prepareCheckpoint
in interface WindowProcessor<Long>
Exception
public void clearWindow(long timerTimestamp, Long windowEnd) throws Exception
WindowProcessor
Note: the key context has been set.
clearWindow
in interface WindowProcessor<Long>
timerTimestamp
- the fired timestampwindowEnd
- the window to clearException
public void close() throws Exception
WindowProcessor
close
in interface WindowProcessor<Long>
close
in class AbstractWindowAggProcessor<Long>
Exception
public TypeSerializer<Long> createWindowSerializer()
WindowProcessor
createWindowSerializer
in interface WindowProcessor<Long>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.