Interface WindowContext
- All Known Subinterfaces:
OneInputWindowContext<IN>,TwoInputWindowContext<IN1,IN2>
@Experimental
public interface WindowContext
This interface represents a context for window operations and provides methods to interact with
state that is scoped to the window.
-
Method Summary
Modifier and TypeMethodDescriptionlongGets the end timestamp of this window.longGets the starting timestamp of the window.<T,ACC, OUT>
Optional<org.apache.flink.api.common.state.v2.AggregatingState<T,OUT>> getWindowState(org.apache.flink.api.common.state.AggregatingStateDeclaration<T, ACC, OUT> stateDeclaration) Retrieves aAggregatingStateobject that can be used to interact with fault-tolerant state that is scoped to the window.<T> Optional<org.apache.flink.api.common.state.v2.ListState<T>>getWindowState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) Retrieves aListStateobject that can be used to interact with fault-tolerant state that is scoped to the window.<KEY,V> Optional<org.apache.flink.api.common.state.v2.MapState<KEY, V>> getWindowState(org.apache.flink.api.common.state.MapStateDeclaration<KEY, V> stateDeclaration) Retrieves aMapStateobject that can be used to interact with fault-tolerant state that is scoped to the window.<T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>>getWindowState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) Retrieves aReducingStateobject that can be used to interact with fault-tolerant state that is scoped to the window.<T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>>getWindowState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) Retrieves aValueStateobject that can be used to interact with fault-tolerant state that is scoped to the window.
-
Method Details
-
getStartTime
long getStartTime()Gets the starting timestamp of the window. This is the first timestamp that belongs to this window.- Returns:
- The starting timestamp of this window, or -1 if the window is not a time window or a session window.
-
getEndTime
long getEndTime()Gets the end timestamp of this window. The end timestamp is exclusive, meaning it is the first timestamp that does not belong to this window anymore.- Returns:
- The exclusive end timestamp of this window, or -1 if the window is a session window or not a time window.
-
getWindowState
<T> Optional<org.apache.flink.api.common.state.v2.ListState<T>> getWindowState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) throws Exception Retrieves aListStateobject that can be used to interact with fault-tolerant state that is scoped to the window.- Throws:
Exception
-
getWindowState
<KEY,V> Optional<org.apache.flink.api.common.state.v2.MapState<KEY,V>> getWindowState(org.apache.flink.api.common.state.MapStateDeclaration<KEY, V> stateDeclaration) throws ExceptionRetrieves aMapStateobject that can be used to interact with fault-tolerant state that is scoped to the window.- Throws:
Exception
-
getWindowState
<T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>> getWindowState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) throws Exception Retrieves aValueStateobject that can be used to interact with fault-tolerant state that is scoped to the window.- Throws:
Exception
-
getWindowState
<T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>> getWindowState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) throws Exception Retrieves aReducingStateobject that can be used to interact with fault-tolerant state that is scoped to the window.- Throws:
Exception
-
getWindowState
<T,ACC, Optional<org.apache.flink.api.common.state.v2.AggregatingState<T,OUT> OUT>> getWindowState(org.apache.flink.api.common.state.AggregatingStateDeclaration<T, ACC, throws ExceptionOUT> stateDeclaration) Retrieves aAggregatingStateobject that can be used to interact with fault-tolerant state that is scoped to the window.- Throws:
Exception
-