Package org.apache.flink.state.api
Class KeyedStateTransformation<K,T>
java.lang.Object
org.apache.flink.state.api.KeyedStateTransformation<K,T>
- Type Parameters:
K- The type of the key in the Keyed OperatorTransformation.T- The type of the elements in the Keyed OperatorTransformation.
A
KeyedStateTransformation represents a OneInputStateTransformation on which
operator state is partitioned by key using a provided KeySelector.-
Method Summary
Modifier and TypeMethodDescriptiontransform(KeyedStateBootstrapFunction<K, T> processFunction) Applies the givenKeyedStateBootstrapFunctionon the keyed input.transform(SavepointWriterOperatorFactory factory) Method for passing user defined operators along with the type information that will transform the OperatorTransformation.<W extends org.apache.flink.streaming.api.windowing.windows.Window>
WindowedStateTransformation<T,K, W> Windows this transformation into aWindowedOperatorTransformation, which bootstraps state that can be restored by aWindowOperator.
-
Method Details
-
transform
Applies the givenKeyedStateBootstrapFunctionon the keyed input.The function will be called for every element in the input and can be used for writing both keyed and operator state into a
Savepoint.- Parameters:
processFunction- TheKeyedStateBootstrapFunctionthat is called for each element.- Returns:
- An
StateBootstrapTransformationthat can be added to aSavepoint.
-
transform
Method for passing user defined operators along with the type information that will transform the OperatorTransformation.IMPORTANT: Any output from this operator will be discarded.
- Parameters:
factory- A factory returning transformation logic type of the return stream- Returns:
- An
StateBootstrapTransformationthat can be added to aSavepoint.
-
window
public <W extends org.apache.flink.streaming.api.windowing.windows.Window> WindowedStateTransformation<T,K, windowW> (org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<? super T, W> assigner) Windows this transformation into aWindowedOperatorTransformation, which bootstraps state that can be restored by aWindowOperator. Elements are put into windows by aWindowAssigner. The grouping of elements is done both by key and by window.A
Triggercan be defined to specify when windows are evaluated. However,WindowAssignershave a defaultTriggerthat is used if aTriggeris not specified.- Parameters:
assigner- TheWindowAssignerthat assigns elements to windows.
-