@Internal public abstract class AbstractAlignedProcessingTimeWindowOperator<KEY,IN,OUT,STATE,F extends Function> extends AbstractUdfStreamOperator<OUT,F> implements OneInputStreamOperator<IN,OUT>, Triggerable
userFunction
chainingStrategy, LOG, output
Modifier | Constructor and Description |
---|---|
protected |
AbstractAlignedProcessingTimeWindowOperator(F function,
KeySelector<IN,KEY> keySelector,
TypeSerializer<KEY> keySerializer,
TypeSerializer<STATE> stateTypeSerializer,
long windowLength,
long windowSlide) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called after all records have been added to the operators via the methods
OneInputStreamOperator.processElement(StreamRecord) , or
TwoInputStreamOperator.processElement1(StreamRecord) and
TwoInputStreamOperator.processElement2(StreamRecord) . |
protected abstract AbstractKeyedTimePanes<IN,KEY,STATE,OUT> |
createPanes(KeySelector<IN,KEY> keySelector,
Function function) |
void |
dispose()
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.
|
long |
getNextEvaluationTime() |
long |
getNextSlideTime() |
int |
getNumPanesPerWindow() |
long |
getPaneSize() |
long |
getWindowSize() |
long |
getWindowSlide() |
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic.
|
void |
processElement(StreamRecord<IN> element)
Processes one element that arrived at this operator.
|
void |
processWatermark(Watermark mark)
Processes a
Watermark . |
void |
restoreState(StreamTaskState taskState,
long recoveryTimestamp)
Restores the operator state, if this operator's execution is recovering from a checkpoint.
|
StreamTaskState |
snapshotOperatorState(long checkpointId,
long timestamp)
Called to draw a state snapshot from the operator.
|
String |
toString() |
void |
trigger(long timestamp)
This method is invoked with the timestamp for which the trigger was scheduled.
|
getUserFunction, getUserFunctionParameters, notifyOfCompletedCheckpoint, setOutputType, setup
disableInputCopy, getChainingStrategy, getContainingTask, getExecutionConfig, getOperatorConfig, getPartitionedState, getPartitionedState, getRuntimeContext, getStateBackend, getUserCodeClassloader, isInputCopyingDisabled, registerTimer, setChainingStrategy, setKeyContext, setKeyContextElement1, setKeyContextElement2
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChainingStrategy, isInputCopyingDisabled, notifyOfCompletedCheckpoint, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setup
protected AbstractAlignedProcessingTimeWindowOperator(F function, KeySelector<IN,KEY> keySelector, TypeSerializer<KEY> keySerializer, TypeSerializer<STATE> stateTypeSerializer, long windowLength, long windowSlide)
protected abstract AbstractKeyedTimePanes<IN,KEY,STATE,OUT> createPanes(KeySelector<IN,KEY> keySelector, Function function)
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
open
in interface StreamOperator<OUT>
open
in class AbstractUdfStreamOperator<OUT,F extends Function>
Exception
- An exception in this method causes the operator to fail.public void close() throws Exception
AbstractStreamOperator
OneInputStreamOperator.processElement(StreamRecord)
, or
TwoInputStreamOperator.processElement1(StreamRecord)
and
TwoInputStreamOperator.processElement2(StreamRecord)
.
The method is expected to flush all remaining buffered data. Exceptions during this flushing of buffered should be propagated, in order to cause the operation to be recognized asa failed, because the last data items are not processed properly.
close
in interface StreamOperator<OUT>
close
in class AbstractUdfStreamOperator<OUT,F extends Function>
Exception
- An exception in this method causes the operator to fail.public void dispose()
AbstractStreamOperator
dispose
in interface StreamOperator<OUT>
dispose
in class AbstractUdfStreamOperator<OUT,F extends Function>
public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperator
processElement
in interface OneInputStreamOperator<IN,OUT>
Exception
public void processWatermark(Watermark mark)
OneInputStreamOperator
Watermark
.
This method is guaranteed to not be called concurrently with other methods of the operator.processWatermark
in interface OneInputStreamOperator<IN,OUT>
Watermark
public void trigger(long timestamp) throws Exception
Triggerable
If the triggering is delayed for whatever reason (trigger timer was blocked, JVM stalled due to a garbage collection), the timestamp supplied to this function will still be the original timestamp for which the trigger was scheduled.
trigger
in interface Triggerable
timestamp
- The timestamp for which the trigger event was scheduled.Exception
public StreamTaskState snapshotOperatorState(long checkpointId, long timestamp) throws Exception
StreamOperator
snapshotOperatorState
in interface StreamOperator<OUT>
snapshotOperatorState
in class AbstractUdfStreamOperator<OUT,F extends Function>
checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.Exception
- Forwards exceptions that occur while drawing snapshots from the operator
and the key/value state.public void restoreState(StreamTaskState taskState, long recoveryTimestamp) throws Exception
StreamOperator
This method is called after StreamOperator.setup(StreamTask, StreamConfig, Output)
and before StreamOperator.open()
.
restoreState
in interface StreamOperator<OUT>
restoreState
in class AbstractUdfStreamOperator<OUT,F extends Function>
taskState
- The state of operator that was snapshotted as part of checkpoint
from which the execution is restored.recoveryTimestamp
- Global recovery timestampException
- Exceptions during state restore should be forwarded, so that the system can
properly react to failed state restore and fail the execution attempt.public long getWindowSize()
public long getWindowSlide()
public long getPaneSize()
public int getNumPanesPerWindow()
public long getNextEvaluationTime()
public long getNextSlideTime()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.