Class TypeSerializerSchemaCompatibility<T>
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.TypeSerializerSchemaCompatibility<T>
-
- Type Parameters:
T- the type of data serialized by the serializer that was being checked.
@PublicEvolving public class TypeSerializerSchemaCompatibility<T> extends Object
ATypeSerializerSchemaCompatibilityrepresents information about whether or not aTypeSerializercan be safely used to read data written by a previous type serializer.Typically, the compatibility of the new serializer is resolved by checking the serializer snapshot against the
TypeSerializerSnapshotof the previous serializer. Depending on the type of the resolved compatibility result, migration (i.e., reading bytes with the previous serializer and then writing it again with the new serializer) may be required before the new serializer can be used.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> TypeSerializerSchemaCompatibility<T>compatibleAfterMigration()Returns a result that indicates that the new serializer can be used after migrating the written bytes, i.e.static <T> TypeSerializerSchemaCompatibility<T>compatibleAsIs()Returns a result that indicates that the new serializer is compatible and no migration is required.static <T> TypeSerializerSchemaCompatibility<T>compatibleWithReconfiguredSerializer(TypeSerializer<T> reconfiguredSerializer)Returns a result that indicates a reconfigured version of the new serializer is compatible, and should be used instead of the original new serializer.TypeSerializer<T>getReconfiguredSerializer()Gets the reconfigured serializer.static <T> TypeSerializerSchemaCompatibility<T>incompatible()Returns a result that indicates there is no possible way for the new serializer to be use-able.booleanisCompatibleAfterMigration()Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_AFTER_MIGRATION.booleanisCompatibleAsIs()Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_AS_IS.booleanisCompatibleWithReconfiguredSerializer()Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER.booleanisIncompatible()Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.INCOMPATIBLE.StringtoString()
-
-
-
Method Detail
-
compatibleAsIs
public static <T> TypeSerializerSchemaCompatibility<T> compatibleAsIs()
Returns a result that indicates that the new serializer is compatible and no migration is required. The new serializer can continued to be used as is.- Returns:
- a result that indicates migration is not required for the new serializer.
-
compatibleAfterMigration
public static <T> TypeSerializerSchemaCompatibility<T> compatibleAfterMigration()
Returns a result that indicates that the new serializer can be used after migrating the written bytes, i.e. reading it with the old serializer and then writing it again with the new serializer.- Returns:
- a result that indicates that the new serializer can be used after migrating the written bytes.
-
compatibleWithReconfiguredSerializer
public static <T> TypeSerializerSchemaCompatibility<T> compatibleWithReconfiguredSerializer(TypeSerializer<T> reconfiguredSerializer)
Returns a result that indicates a reconfigured version of the new serializer is compatible, and should be used instead of the original new serializer.- Parameters:
reconfiguredSerializer- the reconfigured version of the new serializer.- Returns:
- a result that indicates a reconfigured version of the new serializer is compatible, and should be used instead of the original new serializer.
-
incompatible
public static <T> TypeSerializerSchemaCompatibility<T> incompatible()
Returns a result that indicates there is no possible way for the new serializer to be use-able. This normally indicates that there is no common Java class between what the previous bytes can be deserialized into and what can be written by the new serializer.In this case, there is no possible way for the new serializer to continue to be used, even with migration. Recovery of the Flink job will fail.
- Returns:
- a result that indicates incompatibility between the new and previous serializer.
-
isCompatibleAsIs
public boolean isCompatibleAsIs()
Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_AS_IS.- Returns:
- whether or not the type of the compatibility is
TypeSerializerSchemaCompatibility.Type.COMPATIBLE_AS_IS.
-
isCompatibleAfterMigration
public boolean isCompatibleAfterMigration()
Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_AFTER_MIGRATION.- Returns:
- whether or not the type of the compatibility is
TypeSerializerSchemaCompatibility.Type.COMPATIBLE_AFTER_MIGRATION.
-
isCompatibleWithReconfiguredSerializer
public boolean isCompatibleWithReconfiguredSerializer()
Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER.- Returns:
- whether or not the type of the compatibility is
TypeSerializerSchemaCompatibility.Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER.
-
getReconfiguredSerializer
public TypeSerializer<T> getReconfiguredSerializer()
Gets the reconfigured serializer. This throws an exception ifisCompatibleWithReconfiguredSerializer()isfalse.
-
isIncompatible
public boolean isIncompatible()
Returns whether or not the type of the compatibility isTypeSerializerSchemaCompatibility.Type.INCOMPATIBLE.- Returns:
- whether or not the type of the compatibility is
TypeSerializerSchemaCompatibility.Type.INCOMPATIBLE.
-
-