Class MapStateDescriptor<UK,UV>
- java.lang.Object
-
- org.apache.flink.api.common.state.v2.StateDescriptor<UV>
-
- org.apache.flink.api.common.state.v2.MapStateDescriptor<UK,UV>
-
- Type Parameters:
UK- The type of the user key for this map state.UV- The type of the values that the map state can hold.
- All Implemented Interfaces:
Serializable
@Experimental public class MapStateDescriptor<UK,UV> extends StateDescriptor<UV>
StateDescriptorforMapState. This can be used to create partitioned map state internally.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.api.common.state.v2.StateDescriptor
StateDescriptor.Type
-
-
Constructor Summary
Constructors Constructor Description MapStateDescriptor(String name, Class<UK> keyClass, Class<UV> valueClass)Create a newMapStateDescriptorwith the given name and the given type information.MapStateDescriptor(String stateId, TypeInformation<UK> userKeyTypeInfo, TypeInformation<UV> userValueTypeInfo)Creates a newMapStateDescriptorwith the given stateId and type.MapStateDescriptor(String stateId, TypeSerializer<UK> userKeySerializer, TypeSerializer<UV> userValueSerializer)Create a newMapStateDescriptorwith the given stateId and the given type serializer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateDescriptor.TypegetType()Return the specificTypeof described state.TypeSerializer<UK>getUserKeySerializer()TypeInformation<UK>getUserKeyTypeInformation()voidinitializeSerializerUnlessSet(ExecutionConfig executionConfig)Initializes the serializer, unless it has been initialized before.voidinitializeSerializerUnlessSet(SerializerFactory serializerFactory)booleanisSerializerInitialized()Checks whether the serializer has been initialized.-
Methods inherited from class org.apache.flink.api.common.state.v2.StateDescriptor
enableTimeToLive, equals, getSerializer, getStateId, getTtlConfig, getTypeInformation, hashCode, toString
-
-
-
-
Constructor Detail
-
MapStateDescriptor
public MapStateDescriptor(@Nonnull String stateId, @Nonnull TypeInformation<UK> userKeyTypeInfo, @Nonnull TypeInformation<UV> userValueTypeInfo)Creates a newMapStateDescriptorwith the given stateId and type.- Parameters:
stateId- The (unique) stateId for the state.userKeyTypeInfo- The type of the user keys in the state.userValueTypeInfo- The type of the values in the state.
-
MapStateDescriptor
public MapStateDescriptor(@Nonnull String stateId, @Nonnull TypeSerializer<UK> userKeySerializer, @Nonnull TypeSerializer<UV> userValueSerializer)Create a newMapStateDescriptorwith the given stateId and the given type serializer.- Parameters:
stateId- The (unique) stateId for the state.userKeySerializer- The serializer for the user keys in the state.userValueSerializer- The serializer for the user values in the state.
-
MapStateDescriptor
public MapStateDescriptor(String name, Class<UK> keyClass, Class<UV> valueClass)
Create a newMapStateDescriptorwith the given name and the given type information.If this constructor fails (because it is not possible to describe the type via a class), consider using the
MapStateDescriptor(String, TypeInformation, TypeInformation)constructor.- Parameters:
name- The name of theMapStateDescriptor.keyClass- The class of the type of keys in the state.valueClass- The class of the type of values in the state.
-
-
Method Detail
-
getUserKeySerializer
@Nonnull public TypeSerializer<UK> getUserKeySerializer()
-
getUserKeyTypeInformation
@Internal @Nullable public TypeInformation<UK> getUserKeyTypeInformation()
-
isSerializerInitialized
public boolean isSerializerInitialized()
Checks whether the serializer has been initialized. Serializer initialization is lazy, to allow parametrization of serializers with anExecutionConfigviainitializeSerializerUnlessSet(ExecutionConfig).- Overrides:
isSerializerInitializedin classStateDescriptor<UV>- Returns:
- True if the serializers have been initialized, false otherwise.
-
initializeSerializerUnlessSet
public void initializeSerializerUnlessSet(ExecutionConfig executionConfig)
Initializes the serializer, unless it has been initialized before.- Overrides:
initializeSerializerUnlessSetin classStateDescriptor<UV>- Parameters:
executionConfig- The execution config to use when creating the serializer.
-
initializeSerializerUnlessSet
public void initializeSerializerUnlessSet(SerializerFactory serializerFactory)
- Overrides:
initializeSerializerUnlessSetin classStateDescriptor<UV>
-
getType
public StateDescriptor.Type getType()
Description copied from class:StateDescriptorReturn the specificTypeof described state.- Specified by:
getTypein classStateDescriptor<UV>
-
-