Class AbstractRowTimeUnboundedPrecedingOver<K>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.KeyedProcessFunction<K,IN,OUT>
-
- org.apache.flink.table.runtime.functions.KeyedProcessFunctionWithCleanupState<K,RowData,RowData>
-
- org.apache.flink.table.runtime.operators.over.AbstractRowTimeUnboundedPrecedingOver<K>
-
- All Implemented Interfaces:
Serializable
,Function
,RichFunction
,CleanupState
- Direct Known Subclasses:
RowTimeRangeUnboundedPrecedingFunction
,RowTimeRowsUnboundedPrecedingFunction
public abstract class AbstractRowTimeUnboundedPrecedingOver<K> extends KeyedProcessFunctionWithCleanupState<K,RowData,RowData>
A basic implementation to support unbounded event-time over-window.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.functions.KeyedProcessFunction
KeyedProcessFunction.Context, KeyedProcessFunction.OnTimerContext
-
-
Field Summary
Fields Modifier and Type Field Description protected AggsHandleFunction
function
protected JoinedRowData
output
-
Fields inherited from class org.apache.flink.table.runtime.functions.KeyedProcessFunctionWithCleanupState
stateCleaningEnabled
-
-
Constructor Summary
Constructors Constructor Description AbstractRowTimeUnboundedPrecedingOver(long minRetentionTime, long maxRetentionTime, GeneratedAggsHandleFunction genAggsHandler, LogicalType[] accTypes, LogicalType[] inputFieldTypes, int rowTimeIdx)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Tear-down method for the user code.protected Counter
getCounter()
void
onTimer(long timestamp, KeyedProcessFunction.OnTimerContext ctx, Collector<RowData> out)
Called when a timer set usingTimerService
fires.void
open(OpenContext openContext)
Initialization method for the function.void
processElement(RowData input, KeyedProcessFunction.Context ctx, Collector<RowData> out)
Puts an element from the input stream into state if it is not late.protected abstract void
processElementsWithSameTimestamp(List<RowData> curRowList, Collector<RowData> out)
Process the same timestamp datas, the mechanism is different between rows and range window.-
Methods inherited from class org.apache.flink.table.runtime.functions.KeyedProcessFunctionWithCleanupState
cleanupState, initCleanupTimeState, isProcessingTimeTimer, needToCleanupState, registerProcessingCleanupTimer
-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.runtime.functions.CleanupState
registerProcessingCleanupTimer
-
-
-
-
Field Detail
-
output
protected transient JoinedRowData output
-
function
protected transient AggsHandleFunction function
-
-
Constructor Detail
-
AbstractRowTimeUnboundedPrecedingOver
public AbstractRowTimeUnboundedPrecedingOver(long minRetentionTime, long maxRetentionTime, GeneratedAggsHandleFunction genAggsHandler, LogicalType[] accTypes, LogicalType[] inputFieldTypes, int rowTimeIdx)
-
-
Method Detail
-
getCounter
@VisibleForTesting protected Counter getCounter()
-
open
public void open(OpenContext openContext) throws Exception
Description copied from interface:RichFunction
Initialization method for the function. It is called before the actual working methods (like map or join) and thus suitable for one time setup work. For functions that are part of an iteration, this method will be invoked at the beginning of each iteration superstep.The openContext object passed to the function can be used for configuration and initialization. The openContext contains some necessary information that were configured on the function in the program composition.
public class MyFilter extends RichFilterFunction<String> { private String searchString; public void open(OpenContext openContext) { // initialize the value of searchString } public boolean filter(String value) { return value.equals(searchString); } }
- Specified by:
open
in interfaceRichFunction
- Overrides:
open
in classAbstractRichFunction
- Parameters:
openContext
- The context containing information about the context in which the function is opened.- Throws:
Exception
- Implementations may forward exceptions, which are caught by the runtime. When the runtime catches an exception, it aborts the task and lets the fail-over logic decide whether to retry the task execution.
-
processElement
public void processElement(RowData input, KeyedProcessFunction.Context ctx, Collector<RowData> out) throws Exception
Puts an element from the input stream into state if it is not late. Registers a timer for the next watermark.- Specified by:
processElement
in classKeyedProcessFunction<K,RowData,RowData>
- Parameters:
input
- The input value.ctx
- AKeyedProcessFunction.Context
that allows querying the timestamp of the element and getting TimerService for registering timers and querying the time. The context is only valid during the invocation of this method, do not store it.out
- The collector for returning result values.- Throws:
Exception
-
onTimer
public void onTimer(long timestamp, KeyedProcessFunction.OnTimerContext ctx, Collector<RowData> out) throws Exception
Description copied from class:KeyedProcessFunction
Called when a timer set usingTimerService
fires.- Overrides:
onTimer
in classKeyedProcessFunction<K,RowData,RowData>
- Parameters:
timestamp
- The timestamp of the firing timer.ctx
- AnKeyedProcessFunction.OnTimerContext
that allows querying the timestamp, theTimeDomain
, and the key of the firing timer and getting aTimerService
for registering timers and querying the time. The context is only valid during the invocation of this method, do not store it.out
- The collector for returning result values.- Throws:
Exception
- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
-
processElementsWithSameTimestamp
protected abstract void processElementsWithSameTimestamp(List<RowData> curRowList, Collector<RowData> out) throws Exception
Process the same timestamp datas, the mechanism is different between rows and range window.- Throws:
Exception
-
close
public void close() throws Exception
Description copied from interface:RichFunction
Tear-down method for the user code. It is called after the last call to the main working methods (e.g. map or join). For functions that are part of an iteration, this method will be invoked after each iteration superstep.This method can be used for clean up work.
- Specified by:
close
in interfaceRichFunction
- Overrides:
close
in classAbstractRichFunction
- Throws:
Exception
- Implementations may forward exceptions, which are caught by the runtime. When the runtime catches an exception, it aborts the task and lets the fail-over logic decide whether to retry the task execution.
-
-