igalshilman commented on a change in pull request #7658: [FLINK-10493][core]
Migrating the TupleSerializerBase serializers family
URL: https://github.com/apache/flink/pull/7658#discussion_r255386093
##########
File path:
flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerConfigSnapshot.java
##########
@@ -155,4 +158,38 @@ else if (serializer instanceof
UnloadableDummyTypeSerializer) {
TypeSerializerSchemaCompatibility.incompatible() :
TypeSerializerSchemaCompatibility.compatibleAsIs();
}
+
+ /**
+ * SelfResolving assists with the migration path to the new
serialization abstraction.
+ *
+ * <p>Previously some {@link TypeSerializer}s were reusing the same
{@link TypeSerializerConfigSnapshot} class in
+ * {@link TypeSerializer#snapshotConfiguration()}, which is considered
anti-pattern, and in general each serializer
+ * should have its own dedicated snapshot class. (For example the
{@code TupleSerializerConfigSnapshot} was used by
+ * few different serializers).
+ *
+ * <p>This interface helps to ease the migration for such serializers
by allowing them to "redirect" the
+ * compatibility check to the corresponding {code
TypeSerializerSnapshot} class.
+ * Make sure that your type serializer is implementing this interface.
+ *
+ * <p>Please note that if it is possible to directly override
+ * {@link TypeSerializerConfigSnapshot#resolveSchemaCompatibility} and
preform the redirection logic from there,
+ * then that is the preferred way. This interface is useful for cases
where there is not enough information,
+ * and the new serializer should assist with the redirection.
+ */
+ @Internal
+ public interface SelfResolvingTypeSerializer<E> {
Review comment:
I'm a bit reluctant to do this at this point, I think that what you are
suggesting is maybe a different interface with slightly different
methods/signatures (i.e. receives `TypeSerializerSnapshot` instead
`ConfigSnapshot`) and it should be used at a different place (at every
`resolveSchemaCompatability()` implementation).
I think that just making it top level won't make a difference.
Maybe reserve the name `SelfResolvingTypeSerializer` for what you are
suggesting, and use a different name for this inner interface, like:
`SelfMigratingTypeSerialzer` or `RedirectingTypeSerializer` or something like
that?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services