K
- The type of key returned by the KeySelector
.IN
- The type of the incoming elements.OUT
- The type of elements emitted by the InternalWindowFunction
.W
- The type of Window
that the WindowAssigner
assigns.@Internal public class EvictingWindowOperator<K,IN,OUT,W extends Window> extends WindowOperator<K,IN,Iterable<IN>,OUT,W>
WindowOperator
that also allows an Evictor
to be used.
The Evictor
is used to remove elements from a pane before/after the evaluation of
InternalWindowFunction
and after the window evaluation gets triggered by a Trigger
.
WindowOperator.AbstractPerWindowStateStore, WindowOperator.Context, WindowOperator.MergingWindowStateStore, WindowOperator.PerWindowStateStore, WindowOperator.Timer<K,W extends Window>, WindowOperator.WindowContext
allowedLateness, internalTimerService, keySerializer, lateDataOutputTag, numLateRecordsDropped, processContext, timestampedCollector, triggerContext, windowAssigner, windowAssignerContext, windowSerializer
userFunction
chainingStrategy, config, latencyStats, LOG, metrics, output, processingTimeService
Constructor and Description |
---|
EvictingWindowOperator(WindowAssigner<? super IN,W> windowAssigner,
TypeSerializer<W> windowSerializer,
KeySelector<IN,K> keySelector,
TypeSerializer<K> keySerializer,
StateDescriptor<? extends ListState<StreamRecord<IN>>,?> windowStateDescriptor,
InternalWindowFunction<Iterable<IN>,OUT,K,W> windowFunction,
Trigger<? super IN,? super W> trigger,
Evictor<? super IN,? super W> evictor,
long allowedLateness,
OutputTag<IN> lateDataOutputTag) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called at the very end of the operator's life, both in the case of a
successful completion of the operation, and in the case of a failure and canceling.
|
Evictor<? super IN,? super W> |
getEvictor() |
StateDescriptor<? extends AppendingState<IN,Iterable<IN>>,?> |
getStateDescriptor() |
void |
onEventTime(InternalTimer<K,W> timer)
Invoked when an event-time timer fires.
|
void |
onProcessingTime(InternalTimer<K,W> timer)
Invoked when a processing-time timer fires.
|
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic, e.g.
|
void |
processElement(StreamRecord<IN> element)
Processes one element that arrived on this input of the
MultipleInputStreamOperator . |
deleteCleanupTimer, getKeySelector, getMergingWindowSet, getTrigger, getWindowAssigner, isCleanupTime, isElementLate, isWindowLate, registerCleanupTimer, sideOutput
finish, getUserFunction, getUserFunctionParameters, initializeState, notifyCheckpointAborted, notifyCheckpointComplete, setOutputType, setup, snapshotState
getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, isUsingCustomRawKeyedState, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, snapshotState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setKeyContextElement
finish, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
notifyCheckpointAborted, notifyCheckpointComplete
getCurrentKey, setCurrentKey
processLatencyMarker, processWatermark, processWatermarkStatus
hasKeyContext
public EvictingWindowOperator(WindowAssigner<? super IN,W> windowAssigner, TypeSerializer<W> windowSerializer, KeySelector<IN,K> keySelector, TypeSerializer<K> keySerializer, StateDescriptor<? extends ListState<StreamRecord<IN>>,?> windowStateDescriptor, InternalWindowFunction<Iterable<IN>,OUT,K,W> windowFunction, Trigger<? super IN,? super W> trigger, Evictor<? super IN,? super W> evictor, long allowedLateness, OutputTag<IN> lateDataOutputTag)
public void processElement(StreamRecord<IN> element) throws Exception
Input
MultipleInputStreamOperator
.
This method is guaranteed to not be called concurrently with other methods of the operator.processElement
in interface Input<IN>
processElement
in class WindowOperator<K,IN,Iterable<IN>,OUT,W extends Window>
Exception
public void onEventTime(InternalTimer<K,W> timer) throws Exception
Triggerable
onEventTime
in interface Triggerable<K,W extends Window>
onEventTime
in class WindowOperator<K,IN,Iterable<IN>,OUT,W extends Window>
Exception
public void onProcessingTime(InternalTimer<K,W> timer) throws Exception
Triggerable
onProcessingTime
in interface Triggerable<K,W extends Window>
onProcessingTime
in class WindowOperator<K,IN,Iterable<IN>,OUT,W extends Window>
Exception
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
public void close() throws Exception
StreamOperator
This method is expected to make a thorough effort to release all resources that the operator has acquired.
NOTE:It can not emit any records! If you need to emit records at the end of
processing, do so in the StreamOperator.finish()
method.
@VisibleForTesting public Evictor<? super IN,? super W> getEvictor()
@VisibleForTesting public StateDescriptor<? extends AppendingState<IN,Iterable<IN>>,?> getStateDescriptor()
getStateDescriptor
in class WindowOperator<K,IN,Iterable<IN>,OUT,W extends Window>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.