use of org.apache.flink.api.common.typeutils.BackwardsCompatibleSerializerSnapshot in project flink by apache.
the class KeyedBackendSerializationProxy method read.
@SuppressWarnings("unchecked")
@Override
public void read(DataInputView in) throws IOException {
super.read(in);
final int readVersion = getReadVersion();
if (readVersion >= 4) {
usingKeyGroupCompression = in.readBoolean();
} else {
usingKeyGroupCompression = false;
}
// only starting from version 3, we have the key serializer and its config snapshot written
if (readVersion >= 6) {
this.keySerializerSnapshot = TypeSerializerSnapshotSerializationUtil.readSerializerSnapshot(in, userCodeClassLoader, null);
} else if (readVersion >= 3) {
Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>> keySerializerAndConfig = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, userCodeClassLoader).get(0);
this.keySerializerSnapshot = (TypeSerializerSnapshot<K>) keySerializerAndConfig.f1;
} else {
this.keySerializerSnapshot = new BackwardsCompatibleSerializerSnapshot<>(TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, true));
}
this.keySerializer = null;
Integer metaInfoSnapshotVersion = META_INFO_SNAPSHOT_FORMAT_VERSION_MAPPER.get(readVersion);
if (metaInfoSnapshotVersion == null) {
// this should not happen; guard for the future
throw new IOException("Cannot determine corresponding meta info snapshot version for keyed backend serialization readVersion=" + readVersion);
}
final StateMetaInfoReader stateMetaInfoReader = StateMetaInfoSnapshotReadersWriters.getReader(metaInfoSnapshotVersion, StateMetaInfoSnapshotReadersWriters.StateTypeHint.KEYED_STATE);
int numKvStates = in.readShort();
stateMetaInfoSnapshots = new ArrayList<>(numKvStates);
for (int i = 0; i < numKvStates; i++) {
StateMetaInfoSnapshot snapshot = stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader);
stateMetaInfoSnapshots.add(snapshot);
}
}
Aggregations