Package org.apache.flink.state.api
Class OneInputStateTransformation<T>
- java.lang.Object
-
- org.apache.flink.state.api.OneInputStateTransformation<T>
-
- Type Parameters:
T
- The type of the elements in this operator.
@PublicEvolving public class OneInputStateTransformation<T> extends Object
OneInputStateTransformation
represents a user defined transformation applied on anOperatorTransformation
with one input.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyedStateTransformation<org.apache.flink.api.java.tuple.Tuple,T>
keyBy(int... fields)
Partitions the operator state of aOperatorTransformation
by the given key positions.KeyedStateTransformation<org.apache.flink.api.java.tuple.Tuple,T>
keyBy(String... fields)
Partitions the operator state of aOperatorTransformation
using field expressions.<K> KeyedStateTransformation<K,T>
keyBy(org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)
It creates a newKeyedOperatorTransformation
that uses the provided key for partitioning its operator states.<K> KeyedStateTransformation<K,T>
keyBy(org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> keyType)
It creates a newKeyedOperatorTransformation
that uses the provided key with explicit type information for partitioning its operator states.OneInputStateTransformation<T>
setMaxParallelism(int maxParallelism)
Sets the maximum parallelism of this operator.StateBootstrapTransformation<T>
transform(BroadcastStateBootstrapFunction<T> processFunction)
Applies the givenBroadcastStateBootstrapFunction
on the non-keyed input.StateBootstrapTransformation<T>
transform(StateBootstrapFunction<T> processFunction)
Applies the givenStateBootstrapFunction
on the non-keyed input.StateBootstrapTransformation<T>
transform(SavepointWriterOperatorFactory factory)
Method for passing user defined operators along with the type information that will transform the OperatorTransformation.
-
-
-
Method Detail
-
setMaxParallelism
@PublicEvolving public OneInputStateTransformation<T> setMaxParallelism(int maxParallelism)
Sets the maximum parallelism of this operator.The maximum parallelism specifies the upper bound for dynamic scaling. It also defines the number of key groups used for partitioned state.
- Parameters:
maxParallelism
- Maximum parallelism- Returns:
- The operator with set maximum parallelism
-
transform
public StateBootstrapTransformation<T> transform(StateBootstrapFunction<T> processFunction)
Applies the givenStateBootstrapFunction
on the non-keyed input.The function will be called for every element in the input and can be used for writing operator state into a
Savepoint
.- Parameters:
processFunction
- TheStateBootstrapFunction
that is called for each element.- Returns:
- An
OperatorTransformation
that can be added to aSavepoint
.
-
transform
public StateBootstrapTransformation<T> transform(BroadcastStateBootstrapFunction<T> processFunction)
Applies the givenBroadcastStateBootstrapFunction
on the non-keyed input.The function will be called for every element in the input and can be used for writing broadcast state into a
Savepoint
.- Parameters:
processFunction
- TheBroadcastStateBootstrapFunction
that is called for each element.- Returns:
- An
StateBootstrapTransformation
that can be added to aSavepoint
.
-
transform
public StateBootstrapTransformation<T> transform(SavepointWriterOperatorFactory factory)
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
StateBootstrapTransformation
that can be added to aSavepoint
.
-
keyBy
public <K> KeyedStateTransformation<K,T> keyBy(org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)
It creates a newKeyedOperatorTransformation
that uses the provided key for partitioning its operator states.- Parameters:
keySelector
- The KeySelector to be used for extracting the key for partitioning.- Returns:
- The
BootstrapTransformation
with partitioned state.
-
keyBy
public <K> KeyedStateTransformation<K,T> keyBy(org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> keyType)
It creates a newKeyedOperatorTransformation
that uses the provided key with explicit type information for partitioning its operator states.- Parameters:
keySelector
- The KeySelector to be used for extracting the key for partitioning.keyType
- The type information describing the key type.- Returns:
- The
BootstrapTransformation
with partitioned state.
-
keyBy
public KeyedStateTransformation<org.apache.flink.api.java.tuple.Tuple,T> keyBy(int... fields)
Partitions the operator state of aOperatorTransformation
by the given key positions.- Parameters:
fields
- The position of the fields on which theOperatorTransformation
will be grouped.- Returns:
- The
OperatorTransformation
with partitioned state.
-
keyBy
public KeyedStateTransformation<org.apache.flink.api.java.tuple.Tuple,T> keyBy(String... fields)
Partitions the operator state of aOperatorTransformation
using field expressions. A field expression is either the name of a public field or a getter method with parentheses of theOperatorTransformation
's underlying type. A dot can be used to drill down into objects, as in"field1.getInnerField2()"
.- Parameters:
fields
- One or more field expressions on which the state of theOperatorTransformation
operators will be partitioned.- Returns:
- The
OperatorTransformation
with partitioned state (i.e. KeyedStream)
-
-