Class WindowedStateTransformation<T,K,W extends Window>
- java.lang.Object
-
- org.apache.flink.state.api.WindowedStateTransformation<T,K,W>
-
- Type Parameters:
K
- The type of the key in the window.T
- The type of the elements in the window.W
- The type of the window.
@PublicEvolving public class WindowedStateTransformation<T,K,W extends Window> extends Object
AWindowedStateTransformation
represents aOneInputStateTransformation
for bootstrapping window state.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <ACC,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,R> function)
Applies the given aggregation function to each window.<ACC,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,R> function, TypeInformation<ACC> accumulatorType)
Applies the given aggregation function to each window.<ACC,V,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,V> aggFunction, ProcessWindowFunction<V,R,K,W> windowFunction)
Applies the given window function to each window.<ACC,V,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,V> aggregateFunction, ProcessWindowFunction<V,R,K,W> windowFunction, TypeInformation<ACC> accumulatorType)
Applies the given window function to each window.<ACC,V,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,V> aggFunction, WindowFunction<V,R,K,W> windowFunction)
Applies the given window function to each window.<ACC,V,R>
StateBootstrapTransformation<T>aggregate(AggregateFunction<T,ACC,V> aggregateFunction, WindowFunction<V,R,K,W> windowFunction, TypeInformation<ACC> accumulatorType)
Applies the given window function to each window.<R> StateBootstrapTransformation<T>
apply(WindowFunction<T,R,K,W> function)
Applies the given window function to each window.<R> StateBootstrapTransformation<T>
apply(WindowFunction<T,R,K,W> function, TypeInformation<R> resultType)
Applies the given window function to each window.WindowedStateTransformation<T,K,W>
evictor(Evictor<? super T,? super W> evictor)
Sets theEvictor
that should be used to evict elements from a window before emission.<R> StateBootstrapTransformation<T>
process(ProcessWindowFunction<T,R,K,W> function)
Applies the given window function to each window.StateBootstrapTransformation<T>
reduce(ReduceFunction<T> function)
Applies a reduce function to the window.<R> StateBootstrapTransformation<T>
reduce(ReduceFunction<T> reduceFunction, ProcessWindowFunction<T,R,K,W> function)
Applies the given window function to each window.<R> StateBootstrapTransformation<T>
reduce(ReduceFunction<T> reduceFunction, WindowFunction<T,R,K,W> function)
Applies the given window function to each window.WindowedStateTransformation<T,K,W>
trigger(Trigger<? super T,? super W> trigger)
Sets theTrigger
that should be used to trigger window emission.
-
-
-
Method Detail
-
trigger
@PublicEvolving public WindowedStateTransformation<T,K,W> trigger(Trigger<? super T,? super W> trigger)
Sets theTrigger
that should be used to trigger window emission.
-
evictor
@PublicEvolving public WindowedStateTransformation<T,K,W> evictor(Evictor<? super T,? super W> evictor)
Sets theEvictor
that should be used to evict elements from a window before emission.Note: When using an evictor window performance will degrade significantly, since incremental aggregation of window results cannot be used.
-
reduce
public StateBootstrapTransformation<T> reduce(ReduceFunction<T> function)
Applies a reduce function to the window. The window function is called for each evaluation of the window for each key individually. The output of the reduce function is interpreted as a regular non-windowed stream.This window will try and incrementally aggregate data as much as the window policies permit. For example, tumbling time windows can aggregate the data, meaning that only one element per key is stored. Sliding time windows will aggregate on the granularity of the slide interval, so a few elements are stored per key (one per slide interval). Custom windows may not be able to incrementally aggregate, or may need to store extra values in an aggregation tree.
- Parameters:
function
- The reduce function.- Returns:
- The data stream that is the result of applying the reduce function to the window.
-
reduce
public <R> StateBootstrapTransformation<T> reduce(ReduceFunction<T> reduceFunction, WindowFunction<T,R,K,W> function)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given reducer.
- Parameters:
reduceFunction
- The reduce function that is used for incremental aggregation.function
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
reduce
@Internal public <R> StateBootstrapTransformation<T> reduce(ReduceFunction<T> reduceFunction, ProcessWindowFunction<T,R,K,W> function)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given reducer.
- Parameters:
reduceFunction
- The reduce function that is used for incremental aggregation.function
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
aggregate
@PublicEvolving public <ACC,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,R> function)
Applies the given aggregation function to each window. The aggregation function is called for each element, aggregating values incrementally and keeping the state to one accumulator per key and window.- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorR
- The type of the elements in the resulting stream, equal to the AggregateFunction's result type- Parameters:
function
- The aggregation function.- Returns:
- The data stream that is the result of applying the fold function to the window.
-
aggregate
@PublicEvolving public <ACC,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,R> function, TypeInformation<ACC> accumulatorType)
Applies the given aggregation function to each window. The aggregation function is called for each element, aggregating values incrementally and keeping the state to one accumulator per key and window.- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorR
- The type of the elements in the resulting stream, equal to the AggregateFunction's result type- Parameters:
function
- The aggregation function.- Returns:
- The data stream that is the result of applying the aggregation function to the window.
-
aggregate
@PublicEvolving public <ACC,V,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,V> aggFunction, WindowFunction<V,R,K,W> windowFunction)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given aggregate function. This means that the window function typically has only a single value to process when called.
- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorV
- The type of AggregateFunction's result, and the WindowFunction's inputR
- The type of the elements in the resulting stream, equal to the WindowFunction's result type- Parameters:
aggFunction
- The aggregate function that is used for incremental aggregation.windowFunction
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
aggregate
@PublicEvolving public <ACC,V,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,V> aggregateFunction, WindowFunction<V,R,K,W> windowFunction, TypeInformation<ACC> accumulatorType)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given aggregate function. This means that the window function typically has only a single value to process when called.
- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorV
- The type of AggregateFunction's result, and the WindowFunction's inputR
- The type of the elements in the resulting stream, equal to the WindowFunction's result type- Parameters:
aggregateFunction
- The aggregation function that is used for incremental aggregation.windowFunction
- The window function.accumulatorType
- Type information for the internal accumulator type of the aggregation function- Returns:
- The data stream that is the result of applying the window function to the window.
-
aggregate
@PublicEvolving public <ACC,V,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,V> aggFunction, ProcessWindowFunction<V,R,K,W> windowFunction)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given aggregate function. This means that the window function typically has only a single value to process when called.
- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorV
- The type of AggregateFunction's result, and the WindowFunction's inputR
- The type of the elements in the resulting stream, equal to the WindowFunction's result type- Parameters:
aggFunction
- The aggregate function that is used for incremental aggregation.windowFunction
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
aggregate
@PublicEvolving public <ACC,V,R> StateBootstrapTransformation<T> aggregate(AggregateFunction<T,ACC,V> aggregateFunction, ProcessWindowFunction<V,R,K,W> windowFunction, TypeInformation<ACC> accumulatorType)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Arriving data is incrementally aggregated using the given aggregate function. This means that the window function typically has only a single value to process when called.
- Type Parameters:
ACC
- The type of the AggregateFunction's accumulatorV
- The type of AggregateFunction's result, and the WindowFunction's inputR
- The type of the elements in the resulting stream, equal to the WindowFunction's result type- Parameters:
aggregateFunction
- The aggregation function that is used for incremental aggregation.windowFunction
- The window function.accumulatorType
- Type information for the internal accumulator type of the aggregation function- Returns:
- The data stream that is the result of applying the window function to the window.
-
apply
public <R> StateBootstrapTransformation<T> apply(WindowFunction<T,R,K,W> function)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation.
- Parameters:
function
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
apply
public <R> StateBootstrapTransformation<T> apply(WindowFunction<T,R,K,W> function, TypeInformation<R> resultType)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation.
- Parameters:
function
- The window function.resultType
- Type information for the result type of the window function- Returns:
- The data stream that is the result of applying the window function to the window.
-
process
@PublicEvolving public <R> StateBootstrapTransformation<T> process(ProcessWindowFunction<T,R,K,W> function)
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream.Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation.
- Parameters:
function
- The window function.- Returns:
- The data stream that is the result of applying the window function to the window.
-
-