Class SimpleTypeSerializerSnapshot<T>
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.SimpleTypeSerializerSnapshot<T>
-
- All Implemented Interfaces:
TypeSerializerSnapshot<T>
- Direct Known Subclasses:
BigDecSerializer.BigDecSerializerSnapshot
,BigDecSerializer.BigDecSerializerSnapshot
,BigIntSerializer.BigIntSerializerSnapshot
,BooleanPrimitiveArraySerializer.BooleanPrimitiveArraySerializerSnapshot
,BooleanSerializer.BooleanSerializerSnapshot
,BooleanValueSerializer.BooleanValueSerializerSnapshot
,ByteArrayWrapperSerializer.ByteArrayWrapperSerializerSnapshot
,BytePrimitiveArraySerializer.BytePrimitiveArraySerializerSnapshot
,ByteSerializer.ByteSerializerSnapshot
,ByteValueSerializer.ByteValueSerializerSnapshot
,CharPrimitiveArraySerializer.CharPrimitiveArraySerializerSnapshot
,CharSerializer.CharSerializerSnapshot
,CharValueSerializer.CharValueSerializerSnapshot
,CountWindow.Serializer.CountWindowSerializerSnapshot
,DateSerializer.DateSerializerSnapshot
,DateSerializer.DateSerializerSnapshot
,DeweyNumber.DeweyNumberSerializer.DeweyNumberSerializerSnapshot
,DoublePrimitiveArraySerializer.DoublePrimitiveArraySerializerSnapshot
,DoubleSerializer.DoubleSerializerSnapshot
,DoubleValueSerializer.DoubleValueSerializerSnapshot
,EventId.EventIdSerializer.EventIdSerializerSnapshot
,FloatPrimitiveArraySerializer.FloatPrimitiveArraySerializerSnapshot
,FloatSerializer.FloatSerializerSnapshot
,FloatValueSerializer.FloatValueSerializerSnapshot
,GlobalWindow.Serializer.GlobalWindowSerializerSnapshot
,InstantSerializer.InstantSerializerSnapshot
,IntPrimitiveArraySerializer.IntPrimitiveArraySerializerSnapshot
,IntSerializer.IntSerializerSnapshot
,IntValueSerializer.IntValueSerializerSnapshot
,JavaSerializer.JavaSerializerSnapshot
,LocalDateSerializer.LocalDateSerializerSnapshot
,LocalDateTimeSerializer.LocalDateTimeSerializerSnapshot
,LocalTimeSerializer.LocalTimeSerializerSnapshot
,LongPrimitiveArraySerializer.LongPrimitiveArraySerializerSnapshot
,LongSerializer.LongSerializerSnapshot
,LongValueSerializer.LongValueSerializerSnapshot
,NullSerializer.NullSerializerSnapshot
,NullValueSerializer.NullValueSerializerSnapshot
,ShortPrimitiveArraySerializer.ShortPrimitiveArraySerializerSnapshot
,ShortSerializer.ShortSerializerSnapshot
,ShortValueSerializer.ShortValueSerializerSnapshot
,SqlDateSerializer.SqlDateSerializerSnapshot
,SqlTimeSerializer.SqlTimeSerializerSnapshot
,SqlTimestampSerializer.SqlTimestampSerializerSnapshot
,StatefulComplexPayloadSerializer.Snapshot
,StringArraySerializer.StringArraySerializerSnapshot
,StringDataSerializer.StringDataSerializerSnapshot
,StringSerializer.StringSerializerSnapshot
,StringSerializer.StringSerializerSnapshot
,StringValueSerializer.StringValueSerializerSnapshot
,TimeSerializer.TimeSerializerSnapshot
,TimeWindow.Serializer.TimeWindowSerializerSnapshot
,TimeWindow.Serializer.TimeWindowSerializerSnapshot
,Tuple0SerializerSnapshot
,VoidNamespaceSerializer.VoidNamespaceSerializerSnapshot
,VoidNamespaceSerializer.VoidNamespaceSerializerSnapshot
,VoidSerializer.VoidSerializerSnapshot
@PublicEvolving public abstract class SimpleTypeSerializerSnapshot<T> extends Object implements TypeSerializerSnapshot<T>
A simple base class for TypeSerializerSnapshots, for serializers that have no parameters. The serializer is defined solely by its class name.Serializers that produce these snapshots must be public, have public a zero-argument constructor and cannot be a non-static inner classes.
-
-
Constructor Summary
Constructors Constructor Description SimpleTypeSerializerSnapshot(Supplier<? extends TypeSerializer<T>> serializerSupplier)
Constructor to create snapshot from serializer (writing the snapshot).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getCurrentVersion()
Returns the version of the current snapshot's written binary format.int
hashCode()
void
readSnapshot(int readVersion, DataInputView in, ClassLoader classLoader)
Reads the serializer snapshot from the providedDataInputView
.TypeSerializerSchemaCompatibility<T>
resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)
Checks current serializer's compatibility to read data written by the prior serializer.TypeSerializer<T>
restoreSerializer()
Recreates a serializer instance from this snapshot.String
toString()
void
writeSnapshot(DataOutputView out)
Writes the serializer snapshot to the providedDataOutputView
.
-
-
-
Constructor Detail
-
SimpleTypeSerializerSnapshot
public SimpleTypeSerializerSnapshot(@Nonnull Supplier<? extends TypeSerializer<T>> serializerSupplier)
Constructor to create snapshot from serializer (writing the snapshot).
-
-
Method Detail
-
getCurrentVersion
public int getCurrentVersion()
Description copied from interface:TypeSerializerSnapshot
Returns the version of the current snapshot's written binary format.- Specified by:
getCurrentVersion
in interfaceTypeSerializerSnapshot<T>
- Returns:
- the version of the current snapshot's written binary format.
-
restoreSerializer
public TypeSerializer<T> restoreSerializer()
Description copied from interface:TypeSerializerSnapshot
Recreates a serializer instance from this snapshot. The returned serializer can be safely used to read data written by the prior serializer (i.e., the serializer that created this snapshot).- Specified by:
restoreSerializer
in interfaceTypeSerializerSnapshot<T>
- Returns:
- a serializer instance restored from this serializer snapshot.
-
resolveSchemaCompatibility
public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)
Description copied from interface:TypeSerializerSnapshot
Checks 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:
resolveSchemaCompatibility
in interfaceTypeSerializerSnapshot<T>
- Parameters:
oldSerializerSnapshot
- the old serializer snapshot to check.- Returns:
- the serializer compatibility result.
-
writeSnapshot
public void writeSnapshot(DataOutputView out) throws IOException
Description copied from interface:TypeSerializerSnapshot
Writes the serializer snapshot to the providedDataOutputView
. The current version of the written serializer snapshot's binary format is specified by theTypeSerializerSnapshot.getCurrentVersion()
method.- Specified by:
writeSnapshot
in interfaceTypeSerializerSnapshot<T>
- Parameters:
out
- theDataOutputView
to write the snapshot to.- Throws:
IOException
- Thrown if the snapshot data could not be written.- See Also:
TypeSerializerSnapshot.writeVersionedSnapshot(DataOutputView, TypeSerializerSnapshot)
-
readSnapshot
public void readSnapshot(int readVersion, DataInputView in, ClassLoader classLoader) throws IOException
Description copied from interface:TypeSerializerSnapshot
Reads the serializer snapshot from the providedDataInputView
. The version of the binary format that the serializer snapshot was written with is provided. This version can be used to determine how the serializer snapshot should be read.- Specified by:
readSnapshot
in interfaceTypeSerializerSnapshot<T>
- Parameters:
readVersion
- version of the serializer snapshot's written binary formatin
- theDataInputView
to read the snapshot from.classLoader
- the user code classloader- Throws:
IOException
- Thrown if the snapshot data could be read or parsed.- See Also:
TypeSerializerSnapshot.readVersionedSnapshot(DataInputView, ClassLoader)
-
-