K - The type of key returned by the KeySelector.W - The type of Window that the WindowAssigner assigns.public abstract class WindowOperator<K,W extends Window>
extends org.apache.flink.streaming.api.operators.AbstractStreamOperator<org.apache.flink.table.data.RowData>
implements org.apache.flink.streaming.api.operators.OneInputStreamOperator<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>, org.apache.flink.streaming.api.operators.Triggerable<K,W>
WindowAssigner and Trigger.
This is the base class for AggregateWindowOperator and TableAggregateWindowOperator. The big difference between AggregateWindowOperator and
TableAggregateWindowOperator is AggregateWindowOperator emits only one result for
each aggregate group, while TableAggregateWindowOperator can emit multi results for each
aggregate group.
When an element arrives it gets assigned a key using a KeySelector and it gets
assigned to zero or more windows using a WindowAssigner. Based on this, the element is
put into panes. A pane is the bucket of elements that have the same key and same Window.
An element can be in multiple panes if it was assigned to multiple windows by the WindowAssigner.
Each pane gets its own instance of the provided Trigger. This trigger determines when
the contents of the pane should be processed to emit results. When a trigger fires, the given
NamespaceAggsHandleFunctionBase is invoked to
produce the results that are emitted for the pane to which the Trigger belongs.
The parameter types: <IN>: RowData <OUT>: JoinedRowData(KEY, AGG_RESULT)
<KEY>: GenericRowData <AGG_RESULT>: GenericRowData <ACC>: GenericRowData
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.apache.flink.streaming.api.operators.TimestampedCollector<org.apache.flink.table.data.RowData> |
collector
This is used for emitting elements with a given timestamp.
|
protected org.apache.flink.runtime.state.internal.InternalValueState<K,W,org.apache.flink.table.data.RowData> |
previousState |
protected boolean |
produceUpdates |
protected RecordCounter |
recordCounter
Used to count the number of added and retracted input records.
|
protected java.time.ZoneId |
shiftTimeZone
The shift timezone of the window, if the proctime or rowtime type is TIMESTAMP_LTZ, the shift
timezone is the timezone user configured in TableConfig, other cases the timezone is UTC
which means never shift when assigning windows.
|
protected NamespaceAggsHandleFunctionBase<W> |
windowAggregator |
protected InternalWindowProcessFunction<K,W> |
windowFunction |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
protected abstract void |
compileGeneratedCode() |
protected abstract void |
emitWindowResult(W window)
Emits the window result of the given window.
|
protected org.apache.flink.metrics.Counter |
getNumLateRecordsDropped() |
protected org.apache.flink.metrics.Gauge<Long> |
getWatermarkLatency() |
void |
onEventTime(org.apache.flink.streaming.api.operators.InternalTimer<K,W> timer) |
void |
onProcessingTime(org.apache.flink.streaming.api.operators.InternalTimer<K,W> timer) |
void |
open() |
void |
processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.table.data.RowData> record) |
finish, getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, setup, snapshotState, snapshotStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfinish, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotStateprotected final boolean produceUpdates
protected final java.time.ZoneId shiftTimeZone
protected final RecordCounter recordCounter
protected NamespaceAggsHandleFunctionBase<W extends Window> windowAggregator
protected transient InternalWindowProcessFunction<K,W extends Window> windowFunction
protected transient org.apache.flink.streaming.api.operators.TimestampedCollector<org.apache.flink.table.data.RowData> collector
protected abstract void compileGeneratedCode()
public void open()
throws Exception
open 在接口中 org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.table.data.RowData>open 在类中 org.apache.flink.streaming.api.operators.AbstractStreamOperator<org.apache.flink.table.data.RowData>Exceptionpublic void close()
throws Exception
close 在接口中 org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.table.data.RowData>close 在类中 org.apache.flink.streaming.api.operators.AbstractStreamOperator<org.apache.flink.table.data.RowData>Exceptionpublic void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.table.data.RowData> record)
throws Exception
processElement 在接口中 org.apache.flink.streaming.api.operators.Input<org.apache.flink.table.data.RowData>Exceptionpublic void onEventTime(org.apache.flink.streaming.api.operators.InternalTimer<K,W> timer) throws Exception
public void onProcessingTime(org.apache.flink.streaming.api.operators.InternalTimer<K,W> timer) throws Exception
protected abstract void emitWindowResult(W window) throws Exception
Exceptionprotected org.apache.flink.metrics.Counter getNumLateRecordsDropped()
protected org.apache.flink.metrics.Gauge<Long> getWatermarkLatency()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.