Class InternalWindowProcessFunction<K,W extends Window>
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.window.groupwindow.internal.InternalWindowProcessFunction<K,W>
-
- Type Parameters:
W- type of window
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GeneralWindowProcessFunction,MergingWindowProcessFunction,PanedWindowProcessFunction
public abstract class InternalWindowProcessFunction<K,W extends Window> extends Object implements Serializable
The internal interface for functions that process over grouped windows.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceInternalWindowProcessFunction.Context<K,W extends Window>Information available in an invocation of methods ofInternalWindowProcessFunction.
-
Field Summary
Fields Modifier and Type Field Description protected longallowedLatenessprotected InternalWindowProcessFunction.Context<K,W>ctxprotected NamespaceAggsHandleFunctionBase<W>windowAggregatorprotected GroupWindowAssigner<W>windowAssigner
-
Constructor Summary
Constructors Modifier Constructor Description protectedInternalWindowProcessFunction(GroupWindowAssigner<W> windowAssigner, NamespaceAggsHandleFunctionBase<W> windowAggregator, long allowedLateness)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Collection<W>assignActualWindows(org.apache.flink.table.data.RowData inputRow, long timestamp)Assigns the input element into the actual windows which theTriggershould trigger on.abstract Collection<W>assignStateNamespace(org.apache.flink.table.data.RowData inputRow, long timestamp)Assigns the input element into the state namespace which the input element should be accumulated/retracted into.abstract voidcleanWindowIfNeeded(W window, long currentTime)Cleans the given window if needed.voidclose()The tear-down method of the function.protected booleanisCleanupTime(W window, long time)Returnstrueif the given time is the cleanup time for the given window.protected booleanisWindowLate(W window)Returnstrueif the watermark is after the end timestamp plus the allowed lateness of the given window.voidopen(InternalWindowProcessFunction.Context<K,W> ctx)Initialization method for the function.abstract voidprepareAggregateAccumulatorForEmit(W window)Prepares the accumulator of the given window before emit the final result.
-
-
-
Field Detail
-
windowAssigner
protected final GroupWindowAssigner<W extends Window> windowAssigner
-
windowAggregator
protected final NamespaceAggsHandleFunctionBase<W extends Window> windowAggregator
-
allowedLateness
protected final long allowedLateness
-
ctx
protected InternalWindowProcessFunction.Context<K,W extends Window> ctx
-
-
Constructor Detail
-
InternalWindowProcessFunction
protected InternalWindowProcessFunction(GroupWindowAssigner<W> windowAssigner, NamespaceAggsHandleFunctionBase<W> windowAggregator, long allowedLateness)
-
-
Method Detail
-
open
public void open(InternalWindowProcessFunction.Context<K,W> ctx) throws Exception
Initialization method for the function. It is called before the actual working methods.- Throws:
Exception
-
assignStateNamespace
public abstract Collection<W> assignStateNamespace(org.apache.flink.table.data.RowData inputRow, long timestamp) throws Exception
Assigns the input element into the state namespace which the input element should be accumulated/retracted into.- Parameters:
inputRow- the input elementtimestamp- the timestamp of the element or the processing time (depends on the type of assigner)- Returns:
- the state namespace
- Throws:
Exception
-
assignActualWindows
public abstract Collection<W> assignActualWindows(org.apache.flink.table.data.RowData inputRow, long timestamp) throws Exception
Assigns the input element into the actual windows which theTriggershould trigger on.- Parameters:
inputRow- the input elementtimestamp- the timestamp of the element or the processing time (depends on the type of assigner)- Returns:
- the actual windows
- Throws:
Exception
-
prepareAggregateAccumulatorForEmit
public abstract void prepareAggregateAccumulatorForEmit(W window) throws Exception
Prepares the accumulator of the given window before emit the final result. The accumulator is stored in the state or will be created if there is no corresponding accumulator in state.- Parameters:
window- the window- Throws:
Exception
-
cleanWindowIfNeeded
public abstract void cleanWindowIfNeeded(W window, long currentTime) throws Exception
Cleans the given window if needed.- Parameters:
window- the window to cleanupcurrentTime- the current timestamp- Throws:
Exception
-
close
public void close() throws ExceptionThe tear-down method of the function. It is called after the last call to the main working methods.- Throws:
Exception
-
isCleanupTime
protected final boolean isCleanupTime(W window, long time)
Returnstrueif the given time is the cleanup time for the given window.
-
isWindowLate
protected boolean isWindowLate(W window)
Returnstrueif the watermark is after the end timestamp plus the allowed lateness of the given window.
-
-