UK - The type of the keys that can be added to the map state.@PublicEvolving public class MapStateDescriptor<UK,UV> extends StateDescriptor<MapState<UK,UV>,Map<UK,UV>>
StateDescriptor for MapState. This can be used to create state where the type
is a map that can be updated and iterated over.
Using MapState is typically more efficient than manually maintaining a map in a
ValueState, because the backing implementation can support efficient updates, rather then
replacing the full map on write.
To create keyed map state (on a KeyedStream), use
RuntimeContext.getMapState(MapStateDescriptor).
StateDescriptor.TypedefaultValue, name, serializer| Constructor and Description |
|---|
MapStateDescriptor(String name,
Class<UK> keyClass,
Class<UV> valueClass)
Create a new
MapStateDescriptor with the given name and the given type information. |
MapStateDescriptor(String name,
TypeInformation<UK> keyTypeInfo,
TypeInformation<UV> valueTypeInfo)
Create a new
MapStateDescriptor with the given name and the given type informations. |
MapStateDescriptor(String name,
TypeSerializer<UK> keySerializer,
TypeSerializer<UV> valueSerializer)
Create a new
MapStateDescriptor with the given name and the given type serializers. |
| Modifier and Type | Method and Description |
|---|---|
MapState<UK,UV> |
bind(StateBinder stateBinder)
Creates a new
State on the given StateBinder. |
boolean |
equals(Object o) |
TypeSerializer<UK> |
getKeySerializer()
Gets the serializer for the keys in the state.
|
StateDescriptor.Type |
getType() |
TypeSerializer<UV> |
getValueSerializer()
Gets the serializer for the values in the state.
|
int |
hashCode() |
String |
toString() |
getDefaultValue, getName, getQueryableStateName, getSerializer, initializeSerializerUnlessSet, isQueryable, isSerializerInitialized, setQueryablepublic MapStateDescriptor(String name, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer)
MapStateDescriptor with the given name and the given type serializers.name - The name of the MapStateDescriptor.keySerializer - The type serializer for the keys in the state.valueSerializer - The type serializer for the values in the state.public MapStateDescriptor(String name, TypeInformation<UK> keyTypeInfo, TypeInformation<UV> valueTypeInfo)
MapStateDescriptor with the given name and the given type informations.name - The name of the MapStateDescriptor.keyTypeInfo - The type information for the keys in the state.valueTypeInfo - The type information for the values in the state.public MapStateDescriptor(String name, Class<UK> keyClass, Class<UV> valueClass)
MapStateDescriptor with 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.
name - The name of the MapStateDescriptor.keyClass - The class of the type of keys in the state.valueClass - The class of the type of values in the state.public MapState<UK,UV> bind(StateBinder stateBinder) throws Exception
StateDescriptorState on the given StateBinder.public StateDescriptor.Type getType()
public TypeSerializer<UK> getKeySerializer()
public TypeSerializer<UV> getValueSerializer()
public int hashCode()
public boolean equals(Object o)
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.