@Internal public abstract class AbstractAlignedProcessingTimeWindowOperator<KEY,IN,OUT,STATE,F extends org.apache.flink.api.common.functions.Function> extends AbstractUdfStreamOperator<OUT,F> implements OneInputStreamOperator<IN,OUT>, Triggerable
AbstractStreamOperator.CountingOutputuserFunctionchainingStrategy, LOG, metrics, output| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAlignedProcessingTimeWindowOperator(F function,
org.apache.flink.api.java.functions.KeySelector<IN,KEY> keySelector,
org.apache.flink.api.common.typeutils.TypeSerializer<KEY> keySerializer,
org.apache.flink.api.common.typeutils.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(org.apache.flink.api.java.functions.KeySelector<IN,KEY> keySelector,
org.apache.flink.api.common.functions.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)
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, setupgetChainingStrategy, getContainingTask, getCurrentProcessingTime, getExecutionConfig, getMetricGroup, getOperatorConfig, getPartitionedState, getPartitionedState, getRuntimeContext, getStateBackend, getUserCodeClassloader, registerTimer, setChainingStrategy, setKeyContext, setKeyContextElement1, setKeyContextElement2clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChainingStrategy, getMetricGroup, notifyOfCompletedCheckpoint, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setupprotected AbstractAlignedProcessingTimeWindowOperator(F function, org.apache.flink.api.java.functions.KeySelector<IN,KEY> keySelector, org.apache.flink.api.common.typeutils.TypeSerializer<KEY> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<STATE> stateTypeSerializer, long windowLength, long windowSlide)
protected abstract AbstractKeyedTimePanes<IN,KEY,STATE,OUT> createPanes(org.apache.flink.api.java.functions.KeySelector<IN,KEY> keySelector, org.apache.flink.api.common.functions.Function function)
public void open()
throws Exception
AbstractStreamOperatorThe default implementation does nothing.
open in interface StreamOperator<OUT>open in class AbstractUdfStreamOperator<OUT,F extends org.apache.flink.api.common.functions.Function>Exception - An exception in this method causes the operator to fail.public void close()
throws Exception
AbstractStreamOperatorOneInputStreamOperator.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 org.apache.flink.api.common.functions.Function>Exception - An exception in this method causes the operator to fail.public void dispose()
AbstractStreamOperatordispose in interface StreamOperator<OUT>dispose in class AbstractUdfStreamOperator<OUT,F extends org.apache.flink.api.common.functions.Function>public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperatorprocessElement in interface OneInputStreamOperator<IN,OUT>Exceptionpublic void processWatermark(Watermark mark)
OneInputStreamOperatorWatermark.
This method is guaranteed to not be called concurrently with other methods of the operator.processWatermark in interface OneInputStreamOperator<IN,OUT>Watermarkpublic void trigger(long timestamp)
throws Exception
TriggerableIf 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 Triggerabletimestamp - The timestamp for which the trigger event was scheduled.Exceptionpublic StreamTaskState snapshotOperatorState(long checkpointId, long timestamp) throws Exception
StreamOperatorsnapshotOperatorState in interface StreamOperator<OUT>snapshotOperatorState in class AbstractUdfStreamOperator<OUT,F extends org.apache.flink.api.common.functions.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) throws Exception
StreamOperatorThis 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 org.apache.flink.api.common.functions.Function>taskState - The state of operator that was snapshotted as part of checkpoint
from which the execution is restored.Exception - 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–2016 The Apache Software Foundation. All rights reserved.