K
- The type of the keys in the map.V
- The type of the values in the map.@Internal public class MapViewSerializer<K,V> extends org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>> implements org.apache.flink.api.common.typeutils.LegacySerializerSnapshotTransformer<MapView<K,V>>
MapView
. The serializer relies on a key serializer and a value
serializer for the serialization of the map's key-value pairs.
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 marker.
Constructor and Description |
---|
MapViewSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<Map<K,V>> mapSerializer) |
Modifier and Type | Method and Description |
---|---|
void |
copy(org.apache.flink.core.memory.DataInputView source,
org.apache.flink.core.memory.DataOutputView target) |
MapView<K,V> |
copy(MapView<K,V> from) |
MapView<K,V> |
copy(MapView<K,V> from,
MapView<K,V> reuse) |
MapView<K,V> |
createInstance() |
MapView<K,V> |
deserialize(org.apache.flink.core.memory.DataInputView source) |
MapView<K,V> |
deserialize(MapView<K,V> reuse,
org.apache.flink.core.memory.DataInputView source) |
org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>> |
duplicate() |
boolean |
equals(Object obj) |
int |
getLength() |
org.apache.flink.api.common.typeutils.TypeSerializer<Map<K,V>> |
getMapSerializer() |
int |
hashCode() |
boolean |
isImmutableType() |
void |
serialize(MapView<K,V> record,
org.apache.flink.core.memory.DataOutputView target) |
org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<MapView<K,V>> |
snapshotConfiguration() |
<U> org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<MapView<K,V>> |
transformLegacySerializerSnapshot(org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<U> legacySnapshot)
We need to override this as a
LegacySerializerSnapshotTransformer
because in Flink 1.6.x and below, this serializer was incorrectly returning
directly the snapshot of the nested map serializer as its own snapshot. |
public boolean isImmutableType()
public int getLength()
public void serialize(MapView<K,V> record, org.apache.flink.core.memory.DataOutputView target) throws IOException
serialize
in class org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>>
IOException
public MapView<K,V> deserialize(org.apache.flink.core.memory.DataInputView source) throws IOException
deserialize
in class org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>>
IOException
public MapView<K,V> deserialize(MapView<K,V> reuse, org.apache.flink.core.memory.DataInputView source) throws IOException
deserialize
in class org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>>
IOException
public void copy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target) throws IOException
copy
in class org.apache.flink.api.common.typeutils.TypeSerializer<MapView<K,V>>
IOException
public boolean equals(Object obj)
public int hashCode()
public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<MapView<K,V>> snapshotConfiguration()
public <U> org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<MapView<K,V>> transformLegacySerializerSnapshot(org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<U> legacySnapshot)
LegacySerializerSnapshotTransformer
because in Flink 1.6.x and below, this serializer was incorrectly returning
directly the snapshot of the nested map serializer as its own snapshot.
This method transforms the incorrect map serializer snapshot
to be a proper MapViewSerializerSnapshot
.
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.