Class GenericArraySerializerSnapshot<C>
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.CompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>
-
- org.apache.flink.api.common.typeutils.base.GenericArraySerializerSnapshot<C>
-
- Type Parameters:
C- The component type.
- All Implemented Interfaces:
TypeSerializerSnapshot<C[]>
public final class GenericArraySerializerSnapshot<C> extends CompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>
Point-in-time configuration of aGenericArraySerializer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.api.common.typeutils.CompositeTypeSerializerSnapshot
CompositeTypeSerializerSnapshot.OuterSchemaCompatibility
-
-
Constructor Summary
Constructors Constructor Description GenericArraySerializerSnapshot()Constructor to be used for read instantiation.GenericArraySerializerSnapshot(GenericArraySerializer<C> genericArraySerializer)Constructor to be used for writing the snapshot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GenericArraySerializer<C>createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers)Creates an instance of the outer serializer with a given array of its nested serializers.protected intgetCurrentOuterSnapshotVersion()Returns the version of the current outer snapshot's written binary format.protected TypeSerializer<?>[]getNestedSerializers(GenericArraySerializer<C> outerSerializer)Gets the nested serializers from the outer serializer.protected voidreadOuterSnapshot(int readOuterSnapshotVersion, DataInputView in, ClassLoader userCodeClassLoader)Reads the outer snapshot, i.e.protected CompositeTypeSerializerSnapshot.OuterSchemaCompatibilityresolveOuterSchemaCompatibility(TypeSerializerSnapshot<C[]> oldSerializerSnapshot)Checks the schema compatibility of the given old serializer snapshot based on the outer snapshot.TypeSerializerSchemaCompatibility<C[]>resolveSchemaCompatibility(TypeSerializerSnapshot<C[]> oldSerializerSnapshot)Checks current serializer's compatibility to read data written by the prior serializer.protected voidwriteOuterSnapshot(DataOutputView out)Writes the outer snapshot, i.e.-
Methods inherited from class org.apache.flink.api.common.typeutils.CompositeTypeSerializerSnapshot
getCurrentVersion, getNestedSerializerSnapshots, isOuterSnapshotCompatible, readSnapshot, resolveOuterSchemaCompatibility, restoreSerializer, writeSnapshot
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.typeutils.TypeSerializerSnapshot
resolveSchemaCompatibility
-
-
-
-
Constructor Detail
-
GenericArraySerializerSnapshot
public GenericArraySerializerSnapshot()
Constructor to be used for read instantiation.
-
GenericArraySerializerSnapshot
public GenericArraySerializerSnapshot(GenericArraySerializer<C> genericArraySerializer)
Constructor to be used for writing the snapshot.
-
-
Method Detail
-
getCurrentOuterSnapshotVersion
protected int getCurrentOuterSnapshotVersion()
Description copied from class:CompositeTypeSerializerSnapshotReturns the version of the current outer snapshot's written binary format.- Specified by:
getCurrentOuterSnapshotVersionin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Returns:
- the version of the current outer snapshot's written binary format.
-
writeOuterSnapshot
protected void writeOuterSnapshot(DataOutputView out) throws IOException
Description copied from class:CompositeTypeSerializerSnapshotWrites the outer snapshot, i.e. any information beyond the nested serializers of the outer serializer.The base implementation of this methods writes nothing, i.e. it assumes that the outer serializer only has nested serializers and no extra information. Otherwise, if the outer serializer contains some extra information that needs to be persisted as part of the serializer snapshot, this must be overridden. Note that this method and the corresponding methods
CompositeTypeSerializerSnapshot.readOuterSnapshot(int, DataInputView, ClassLoader),CompositeTypeSerializerSnapshot.resolveOuterSchemaCompatibility(TypeSerializerSnapshot)needs to be implemented.- Overrides:
writeOuterSnapshotin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
out- theDataOutputViewto write the outer snapshot to.- Throws:
IOException
-
readOuterSnapshot
protected void readOuterSnapshot(int readOuterSnapshotVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOExceptionDescription copied from class:CompositeTypeSerializerSnapshotReads the outer snapshot, i.e. any information beyond the nested serializers of the outer serializer.The base implementation of this methods reads nothing, i.e. it assumes that the outer serializer only has nested serializers and no extra information. Otherwise, if the outer serializer contains some extra information that has been persisted as part of the serializer snapshot, this must be overridden. Note that this method and the corresponding methods
CompositeTypeSerializerSnapshot.writeOuterSnapshot(DataOutputView),CompositeTypeSerializerSnapshot.resolveOuterSchemaCompatibility(TypeSerializerSnapshot)needs to be implemented.- Overrides:
readOuterSnapshotin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
readOuterSnapshotVersion- the read version of the outer snapshot.in- theDataInputViewto read the outer snapshot from.userCodeClassLoader- the user code class loader.- Throws:
IOException
-
resolveSchemaCompatibility
public TypeSerializerSchemaCompatibility<C[]> resolveSchemaCompatibility(TypeSerializerSnapshot<C[]> oldSerializerSnapshot)
Description copied from interface:TypeSerializerSnapshotChecks current serializer's compatibility to read data written by the prior serializer.When a checkpoint/savepoint is restored, this method checks whether the serialization format of the data in the checkpoint/savepoint is compatible for the format of the serializer used by the program that restores the checkpoint/savepoint. The outcome can be that the serialization format is compatible, that the program's serializer needs to reconfigure itself (meaning to incorporate some information from the TypeSerializerSnapshot to be compatible), that the format is outright incompatible, or that a migration needed. In the latter case, the TypeSerializerSnapshot produces a serializer to deserialize the data, and the restoring program's serializer re-serializes the data, thus converting the format during the restore operation.
This method must be implemented to clarify the compatibility. See FLIP-263 for more details.
- Specified by:
resolveSchemaCompatibilityin interfaceTypeSerializerSnapshot<C>- Overrides:
resolveSchemaCompatibilityin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
oldSerializerSnapshot- the old serializer snapshot to check.- Returns:
- the serializer compatibility result.
-
resolveOuterSchemaCompatibility
protected CompositeTypeSerializerSnapshot.OuterSchemaCompatibility resolveOuterSchemaCompatibility(TypeSerializerSnapshot<C[]> oldSerializerSnapshot)
Description copied from class:CompositeTypeSerializerSnapshotChecks the schema compatibility of the given old serializer snapshot based on the outer snapshot.The base implementation of this method assumes that the outer serializer only has nested serializers and no extra information, and therefore the result of the check is
CompositeTypeSerializerSnapshot.OuterSchemaCompatibility.COMPATIBLE_AS_IS. Otherwise, if the outer serializer contains some extra information that has been persisted as part of the serializer snapshot, this must be overridden. Note that this method and the corresponding methodsCompositeTypeSerializerSnapshot.writeOuterSnapshot(DataOutputView),CompositeTypeSerializerSnapshot.readOuterSnapshot(int, DataInputView, ClassLoader)needs to be implemented.- Overrides:
resolveOuterSchemaCompatibilityin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
oldSerializerSnapshot- the old serializer snapshot, which contains the old outer information to check against.- Returns:
- a
CompositeTypeSerializerSnapshot.OuterSchemaCompatibilityindicating whether the new serializer's outer information is compatible, requires migration, or incompatible with the one written in this snapshot.
-
createOuterSerializerWithNestedSerializers
protected GenericArraySerializer<C> createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers)
Description copied from class:CompositeTypeSerializerSnapshotCreates an instance of the outer serializer with a given array of its nested serializers.- Specified by:
createOuterSerializerWithNestedSerializersin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
nestedSerializers- array of nested serializers to create the outer serializer with.- Returns:
- an instance of the outer serializer.
-
getNestedSerializers
protected TypeSerializer<?>[] getNestedSerializers(GenericArraySerializer<C> outerSerializer)
Description copied from class:CompositeTypeSerializerSnapshotGets the nested serializers from the outer serializer.- Specified by:
getNestedSerializersin classCompositeTypeSerializerSnapshot<C[],GenericArraySerializer<C>>- Parameters:
outerSerializer- the outer serializer.- Returns:
- the nested serializers.
-
-