tzulitai commented on a change in pull request #7695: [FLINK-11591][core]
Support legacy TypeSerializerSnapshot transformations
URL: https://github.com/apache/flink/pull/7695#discussion_r256686830
##########
File path:
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java
##########
@@ -190,26 +191,35 @@ public boolean canEqual(Object obj) {
return new LockableTypeSerializerSnapshot<>(this);
}
- /**
- * This cannot be removed until {@link
TypeSerializerConfigSnapshot} is no longer supported.
- */
- @Override
- public CompatibilityResult<Lockable<E>>
ensureCompatibility(TypeSerializerConfigSnapshot<?> configSnapshot) {
- // backwards compatibility path
- CompatibilityResult<E> inputCompatibilityResult =
CompatibilityUtil.resolveCompatibilityResult(
- configSnapshot.restoreSerializer(),
- UnloadableDummyTypeSerializer.class,
- configSnapshot,
- elementSerializer);
-
- return (inputCompatibilityResult.isRequiresMigration())
- ? CompatibilityResult.requiresMigration()
- : CompatibilityResult.compatible();
- }
-
@VisibleForTesting
TypeSerializer<E> getElementSerializer() {
return elementSerializer;
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <U> TypeSerializerSnapshot<Lockable<E>>
transformLegacySerializerSnapshot(TypeSerializerSnapshot<U> legacySnapshot) {
+ if (legacySnapshot instanceof
LockableTypeSerializerSnapshot) {
+ return (TypeSerializerSnapshot<Lockable<E>>)
legacySnapshot;
+ }
+ // In flink 1.6, this serializer was directly returning
the elementSerializer's snapshot
Review comment:
nit: capital F for Flink
----------------------------------------------------------------
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