Class SortedMapSerializer<K,V>
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.TypeSerializer<M>
-
- org.apache.flink.table.runtime.typeutils.SortedMapSerializer<K,V>
-
- Type Parameters:
K- The type of the keys in the map.V- The type of the values in the map.
- All Implemented Interfaces:
Serializable
public final class SortedMapSerializer<K,V> extends org.apache.flink.api.common.typeutils.TypeSerializer<M>A serializer forSortedMap. The serializer relies on a key serializer and a value serializer for the serialization of the map's key-value pairs. It also deploys a comparator to ensure the order of the keys.The serialization format for the map is as follows: four bytes for the length of the map, followed by the serialized representation of each key-value pair. To allow null values, each value is prefixed by a null flag.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SortedMapSerializer(Comparator<K> comparator, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)Constructor with given comparator, and the serializers for the keys and values in the map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mcopy(M from)Mcopy(M from, M reuse)voidcopy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target)SortedMap<K,V>createInstance()Mdeserialize(M reuse, org.apache.flink.core.memory.DataInputView source)Mdeserialize(org.apache.flink.core.memory.DataInputView source)org.apache.flink.api.common.typeutils.TypeSerializer<SortedMap<K,V>>duplicate()booleanequals(Object o)Comparator<K>getComparator()Returns the comparator for the keys in the map.org.apache.flink.api.common.typeutils.TypeSerializer<K>getKeySerializer()Returns the serializer for the keys in the map.intgetLength()org.apache.flink.api.common.typeutils.TypeSerializer<V>getValueSerializer()Returns the serializer for the values in the map.inthashCode()booleanisImmutableType()voidserialize(M map, org.apache.flink.core.memory.DataOutputView target)org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<SortedMap<K,V>>snapshotConfiguration()StringtoString()
-
-
-
Constructor Detail
-
SortedMapSerializer
public SortedMapSerializer(Comparator<K> comparator, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
Constructor with given comparator, and the serializers for the keys and values in the map.- Parameters:
comparator- The comparator for the keys in the map.keySerializer- The serializer for the keys in the map.valueSerializer- The serializer for the values in the map.
-
-
Method Detail
-
getComparator
public Comparator<K> getComparator()
Returns the comparator for the keys in the map.- Returns:
- The comparator for the keys in the map.
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
snapshotConfiguration
public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<SortedMap<K,V>> snapshotConfiguration()
-
getKeySerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
Returns the serializer for the keys in the map.- Returns:
- The serializer for the keys in the map.
-
getValueSerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<V> getValueSerializer()
Returns the serializer for the values in the map.- Returns:
- The serializer for the values in the map.
-
isImmutableType
public boolean isImmutableType()
- Specified by:
isImmutableTypein classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>
-
copy
public M copy(M from)
- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>
-
copy
public M copy(M from, M reuse)- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>
-
getLength
public int getLength()
- Specified by:
getLengthin classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>
-
serialize
public void serialize(M map, org.apache.flink.core.memory.DataOutputView target) throws IOException- Specified by:
serializein classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>- Throws:
IOException
-
deserialize
public M deserialize(org.apache.flink.core.memory.DataInputView source) throws IOException- Specified by:
deserializein classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>- Throws:
IOException
-
deserialize
public M deserialize(M reuse, org.apache.flink.core.memory.DataInputView source) throws IOException- Specified by:
deserializein classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>- Throws:
IOException
-
copy
public void copy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target) throws IOException- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>- Throws:
IOException
-
-