org.apache.flink.api.common.typeutils.base.CollectionSerializerConfigSnapshot Java Examples
The following examples show how to use
org.apache.flink.api.common.typeutils.base.CollectionSerializerConfigSnapshot.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayListSerializer.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * We need to implement this method as a {@link TypeSerializerConfigSnapshot.SelfResolvingTypeSerializer} * because this serializer was previously returning a shared {@link CollectionSerializerConfigSnapshot} * as its snapshot. * * <p>When the {@link CollectionSerializerConfigSnapshot} is restored, it is incapable of redirecting * the compatibility check to {@link ArrayListSerializerSnapshot}, so we do it here. */ @Override public TypeSerializerSchemaCompatibility<ArrayList<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<ArrayList<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof CollectionSerializerConfigSnapshot) { CollectionSerializerConfigSnapshot<ArrayList<T>, T> castedLegacySnapshot = (CollectionSerializerConfigSnapshot<ArrayList<T>, T>) deprecatedConfigSnapshot; ArrayListSerializerSnapshot<T> newSnapshot = new ArrayListSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacySnapshot.getNestedSerializerSnapshots()); } return TypeSerializerSchemaCompatibility.incompatible(); }
Example #2
Source File: ArrayListSerializer.java From flink with Apache License 2.0 | 6 votes |
/** * We need to implement this method as a {@link TypeSerializerConfigSnapshot.SelfResolvingTypeSerializer} * because this serializer was previously returning a shared {@link CollectionSerializerConfigSnapshot} * as its snapshot. * * <p>When the {@link CollectionSerializerConfigSnapshot} is restored, it is incapable of redirecting * the compatibility check to {@link ArrayListSerializerSnapshot}, so we do it here. */ @Override public TypeSerializerSchemaCompatibility<ArrayList<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<ArrayList<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof CollectionSerializerConfigSnapshot) { CollectionSerializerConfigSnapshot<ArrayList<T>, T> castedLegacySnapshot = (CollectionSerializerConfigSnapshot<ArrayList<T>, T>) deprecatedConfigSnapshot; ArrayListSerializerSnapshot<T> newSnapshot = new ArrayListSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacySnapshot.getNestedSerializerSnapshots()); } return TypeSerializerSchemaCompatibility.incompatible(); }
Example #3
Source File: ArrayListSerializer.java From flink with Apache License 2.0 | 6 votes |
/** * We need to implement this method as a {@link TypeSerializerConfigSnapshot.SelfResolvingTypeSerializer} * because this serializer was previously returning a shared {@link CollectionSerializerConfigSnapshot} * as its snapshot. * * <p>When the {@link CollectionSerializerConfigSnapshot} is restored, it is incapable of redirecting * the compatibility check to {@link ArrayListSerializerSnapshot}, so we do it here. */ @Override public TypeSerializerSchemaCompatibility<ArrayList<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<ArrayList<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof CollectionSerializerConfigSnapshot) { CollectionSerializerConfigSnapshot<ArrayList<T>, T> castedLegacySnapshot = (CollectionSerializerConfigSnapshot<ArrayList<T>, T>) deprecatedConfigSnapshot; ArrayListSerializerSnapshot<T> newSnapshot = new ArrayListSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacySnapshot.getNestedSerializerSnapshots()); } return TypeSerializerSchemaCompatibility.incompatible(); }
Example #4
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 5 votes |
/** * We need to override this as a {@link LegacySerializerSnapshotTransformer} * because in Flink 1.6.x and below, this serializer was incorrectly returning * directly the snapshot of the nested list serializer as its own snapshot. * * <p>This method transforms the incorrect list serializer snapshot * to be a proper {@link ListViewSerializerSnapshot}. */ @Override public <U> TypeSerializerSnapshot<ListView<T>> transformLegacySerializerSnapshot( TypeSerializerSnapshot<U> legacySnapshot) { if (legacySnapshot instanceof ListViewSerializerSnapshot) { return (TypeSerializerSnapshot<ListView<T>>) legacySnapshot; } else if (legacySnapshot instanceof CollectionSerializerConfigSnapshot) { // first, transform the incorrect list serializer's snapshot // into a proper ListSerializerSnapshot ListSerializerSnapshot<T> transformedNestedListSerializerSnapshot = new ListSerializerSnapshot<>(); CollectionSerializerConfigSnapshot<List<T>, T> snapshot = (CollectionSerializerConfigSnapshot<List<T>, T>) legacySnapshot; CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedNestedListSerializerSnapshot, (TypeSerializerSnapshot<?>) (snapshot.getSingleNestedSerializerAndConfig().f1)); // then, wrap the transformed ListSerializerSnapshot // as a nested snapshot in the final resulting ListViewSerializerSnapshot ListViewSerializerSnapshot<T> transformedListViewSerializerSnapshot = new ListViewSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedListViewSerializerSnapshot, transformedNestedListSerializerSnapshot); return transformedListViewSerializerSnapshot; } else { throw new UnsupportedOperationException( legacySnapshot.getClass().getCanonicalName() + " is not supported."); } }
Example #5
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 5 votes |
/** * We need to override this as a {@link LegacySerializerSnapshotTransformer} * because in Flink 1.6.x and below, this serializer was incorrectly returning * directly the snapshot of the nested list serializer as its own snapshot. * * <p>This method transforms the incorrect list serializer snapshot * to be a proper {@link ListViewSerializerSnapshot}. */ @Override public <U> TypeSerializerSnapshot<ListView<T>> transformLegacySerializerSnapshot( TypeSerializerSnapshot<U> legacySnapshot) { if (legacySnapshot instanceof ListViewSerializerSnapshot) { return (TypeSerializerSnapshot<ListView<T>>) legacySnapshot; } else if (legacySnapshot instanceof CollectionSerializerConfigSnapshot) { // first, transform the incorrect list serializer's snapshot // into a proper ListSerializerSnapshot ListSerializerSnapshot<T> transformedNestedListSerializerSnapshot = new ListSerializerSnapshot<>(); CollectionSerializerConfigSnapshot<List<T>, T> snapshot = (CollectionSerializerConfigSnapshot<List<T>, T>) legacySnapshot; CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedNestedListSerializerSnapshot, (TypeSerializerSnapshot<?>) (snapshot.getSingleNestedSerializerAndConfig().f1)); // then, wrap the transformed ListSerializerSnapshot // as a nested snapshot in the final resulting ListViewSerializerSnapshot ListViewSerializerSnapshot<T> transformedListViewSerializerSnapshot = new ListViewSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedListViewSerializerSnapshot, transformedNestedListSerializerSnapshot); return transformedListViewSerializerSnapshot; } else { throw new UnsupportedOperationException( legacySnapshot.getClass().getCanonicalName() + " is not supported."); } }