org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot Java Examples
The following examples show how to use
org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot.
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: TtlStateFactory.java From flink with Apache License 2.0 | 6 votes |
@Override public TypeSerializerSchemaCompatibility<TtlValue<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<TtlValue<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof ConfigSnapshot) { ConfigSnapshot castedLegacyConfigSnapshot = (ConfigSnapshot) deprecatedConfigSnapshot; TtlSerializerSnapshot<T> newSnapshot = new TtlSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacyConfigSnapshot.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: PojoSerializer.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private static <K> LinkedHashMap<K, TypeSerializerSnapshot<?>> preprocessLegacySerializerSnapshotTuples(Map<K, Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> originalMap) { LinkedHashMap<K, TypeSerializerSnapshot<?>> converted = new LinkedHashMap<>(originalMap.size()); originalMap.forEach((key, serializerSnapshotTuple) -> { TypeSerializer<?> serializer = serializerSnapshotTuple.f0; TypeSerializerSnapshot<?> snapshot = serializerSnapshotTuple.f1; if (snapshot instanceof TypeSerializerConfigSnapshot) { ((TypeSerializerConfigSnapshot) snapshot).setPriorSerializer(serializer); } if (serializer instanceof LegacySerializerSnapshotTransformer) { snapshot = ((LegacySerializerSnapshotTransformer) serializer).transformLegacySerializerSnapshot(snapshot); } converted.put(key, snapshot); }); return converted; }
Example #4
Source File: Lockable.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@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 // instead of wrapping it in a LockableTypeSerializer(Config)Snapshot. // This caused state information to be written as <LockableTypeSerializer, SomeArbitrarySerializerSnapshot>, // Therefore we need to preform the following transformation: // 1. set the prior serializer on the legacySnapshot to be the elementSerializer // 2. return a LockableTypeSerializerSnapshot that has the legacySnapshot as a nested snapshot. if (legacySnapshot instanceof TypeSerializerConfigSnapshot) { setElementSerializerAsPriorSerializer(legacySnapshot, this.elementSerializer); } LockableTypeSerializerSnapshot<E> lockableSnapshot = new LockableTypeSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots(lockableSnapshot, legacySnapshot); return lockableSnapshot; }
Example #5
Source File: Lockable.java From flink with Apache License 2.0 | 6 votes |
@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 // instead of wrapping it in a LockableTypeSerializer(Config)Snapshot. // This caused state information to be written as <LockableTypeSerializer, SomeArbitrarySerializerSnapshot>, // Therefore we need to preform the following transformation: // 1. set the prior serializer on the legacySnapshot to be the elementSerializer // 2. return a LockableTypeSerializerSnapshot that has the legacySnapshot as a nested snapshot. if (legacySnapshot instanceof TypeSerializerConfigSnapshot) { setElementSerializerAsPriorSerializer(legacySnapshot, this.elementSerializer); } LockableTypeSerializerSnapshot<E> lockableSnapshot = new LockableTypeSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots(lockableSnapshot, legacySnapshot); return lockableSnapshot; }
Example #6
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 #7
Source File: TtlStateFactory.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public TypeSerializerSchemaCompatibility<TtlValue<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<TtlValue<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof ConfigSnapshot) { ConfigSnapshot castedLegacyConfigSnapshot = (ConfigSnapshot) deprecatedConfigSnapshot; TtlSerializerSnapshot<T> newSnapshot = new TtlSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacyConfigSnapshot.getNestedSerializerSnapshots()); } return TypeSerializerSchemaCompatibility.incompatible(); }
Example #8
Source File: PojoSerializer.java From flink with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private static <K> LinkedHashMap<K, TypeSerializerSnapshot<?>> preprocessLegacySerializerSnapshotTuples(Map<K, Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> originalMap) { LinkedHashMap<K, TypeSerializerSnapshot<?>> converted = new LinkedHashMap<>(originalMap.size()); originalMap.forEach((key, serializerSnapshotTuple) -> { TypeSerializer<?> serializer = serializerSnapshotTuple.f0; TypeSerializerSnapshot<?> snapshot = serializerSnapshotTuple.f1; if (snapshot instanceof TypeSerializerConfigSnapshot) { ((TypeSerializerConfigSnapshot) snapshot).setPriorSerializer(serializer); } if (serializer instanceof LegacySerializerSnapshotTransformer) { snapshot = ((LegacySerializerSnapshotTransformer) serializer).transformLegacySerializerSnapshot(snapshot); } converted.put(key, snapshot); }); return converted; }
Example #9
Source File: TtlStateFactory.java From flink with Apache License 2.0 | 6 votes |
@Override public TypeSerializerSchemaCompatibility<TtlValue<T>> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<TtlValue<T>> deprecatedConfigSnapshot) { if (deprecatedConfigSnapshot instanceof ConfigSnapshot) { ConfigSnapshot castedLegacyConfigSnapshot = (ConfigSnapshot) deprecatedConfigSnapshot; TtlSerializerSnapshot<T> newSnapshot = new TtlSerializerSnapshot<>(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( this, newSnapshot, castedLegacyConfigSnapshot.getNestedSerializerSnapshots()); } return TypeSerializerSchemaCompatibility.incompatible(); }
Example #10
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 #11
Source File: Lockable.java From flink with Apache License 2.0 | 6 votes |
@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 // instead of wrapping it in a LockableTypeSerializer(Config)Snapshot. // This caused state information to be written as <LockableTypeSerializer, SomeArbitrarySerializerSnapshot>, // Therefore we need to preform the following transformation: // 1. set the prior serializer on the legacySnapshot to be the elementSerializer // 2. return a LockableTypeSerializerSnapshot that has the legacySnapshot as a nested snapshot. if (legacySnapshot instanceof TypeSerializerConfigSnapshot) { setElementSerializerAsPriorSerializer(legacySnapshot, this.elementSerializer); } LockableTypeSerializerSnapshot<E> lockableSnapshot = new LockableTypeSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots(lockableSnapshot, legacySnapshot); return lockableSnapshot; }
Example #12
Source File: PojoSerializer.java From flink with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private static <K> LinkedHashMap<K, TypeSerializerSnapshot<?>> preprocessLegacySerializerSnapshotTuples(Map<K, Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> originalMap) { LinkedHashMap<K, TypeSerializerSnapshot<?>> converted = new LinkedHashMap<>(originalMap.size()); originalMap.forEach((key, serializerSnapshotTuple) -> { TypeSerializer<?> serializer = serializerSnapshotTuple.f0; TypeSerializerSnapshot<?> snapshot = serializerSnapshotTuple.f1; if (snapshot instanceof TypeSerializerConfigSnapshot) { ((TypeSerializerConfigSnapshot) snapshot).setPriorSerializer(serializer); } if (serializer instanceof LegacySerializerSnapshotTransformer) { snapshot = ((LegacySerializerSnapshotTransformer) serializer).transformLegacySerializerSnapshot(snapshot); } converted.put(key, snapshot); }); return converted; }
Example #13
Source File: TupleSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass(TypeSerializerConfigSnapshot<T> deprecatedConfigSnapshot) { checkArgument(deprecatedConfigSnapshot instanceof TupleSerializerConfigSnapshot); final TupleSerializerConfigSnapshot<T> configSnapshot = (TupleSerializerConfigSnapshot<T>) deprecatedConfigSnapshot; TypeSerializerSnapshot[] nestedSnapshots = configSnapshot.getNestedSerializersAndConfigs() .stream() .map(t -> t.f1) .toArray(TypeSerializerSnapshot[]::new); TupleSerializerSnapshot<T> newCompositeSnapshot = new TupleSerializerSnapshot<>(configSnapshot.getTupleClass()); return delegateCompatibilityCheckToNewSnapshot(this, newCompositeSnapshot, nestedSnapshots); }
Example #14
Source File: Tuple0Serializer.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<Tuple0> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<Tuple0> deprecatedConfigSnapshot) { Tuple0SerializerSnapshot snapshot = new Tuple0SerializerSnapshot(); return snapshot.resolveSchemaCompatibility(this); }
Example #15
Source File: TupleSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass(TypeSerializerConfigSnapshot<T> deprecatedConfigSnapshot) { checkArgument(deprecatedConfigSnapshot instanceof TupleSerializerConfigSnapshot); final TupleSerializerConfigSnapshot<T> configSnapshot = (TupleSerializerConfigSnapshot<T>) deprecatedConfigSnapshot; TypeSerializerSnapshot[] nestedSnapshots = configSnapshot.getNestedSerializersAndConfigs() .stream() .map(t -> t.f1) .toArray(TypeSerializerSnapshot[]::new); TupleSerializerSnapshot<T> newCompositeSnapshot = new TupleSerializerSnapshot<>(configSnapshot.getTupleClass()); return delegateCompatibilityCheckToNewSnapshot(this, newCompositeSnapshot, nestedSnapshots); }
Example #16
Source File: TupleSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass(TypeSerializerConfigSnapshot<T> deprecatedConfigSnapshot) { checkArgument(deprecatedConfigSnapshot instanceof TupleSerializerConfigSnapshot); final TupleSerializerConfigSnapshot<T> configSnapshot = (TupleSerializerConfigSnapshot<T>) deprecatedConfigSnapshot; TypeSerializerSnapshot[] nestedSnapshots = configSnapshot.getNestedSerializersAndConfigs() .stream() .map(t -> t.f1) .toArray(TypeSerializerSnapshot[]::new); TupleSerializerSnapshot<T> newCompositeSnapshot = new TupleSerializerSnapshot<>(configSnapshot.getTupleClass()); return delegateCompatibilityCheckToNewSnapshot(this, newCompositeSnapshot, nestedSnapshots); }
Example #17
Source File: Tuple0Serializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<Tuple0> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<Tuple0> deprecatedConfigSnapshot) { Tuple0SerializerSnapshot snapshot = new Tuple0SerializerSnapshot(); return snapshot.resolveSchemaCompatibility(this); }
Example #18
Source File: Tuple0Serializer.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeSerializerSchemaCompatibility<Tuple0> resolveSchemaCompatibilityViaRedirectingToNewSnapshotClass( TypeSerializerConfigSnapshot<Tuple0> deprecatedConfigSnapshot) { Tuple0SerializerSnapshot snapshot = new Tuple0SerializerSnapshot(); return snapshot.resolveSchemaCompatibility(this); }
Example #19
Source File: IntPairSerializer.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<IntPair> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #20
Source File: IntPairSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<IntPair> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #21
Source File: IntListSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<IntList> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #22
Source File: KvStateRegistryTest.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<String> snapshotConfiguration() { return null; }
Example #23
Source File: CollectionInputFormatTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<ElementType> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #24
Source File: Lockable.java From flink with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private static <U, E> void setElementSerializerAsPriorSerializer(TypeSerializerSnapshot<U> legacySnapshot, TypeSerializer<E> elementSerializer) { TypeSerializerConfigSnapshot<E> elementLegacySnapshot = (TypeSerializerConfigSnapshot<E>) legacySnapshot; elementLegacySnapshot.setPriorSerializer(elementSerializer); }
Example #25
Source File: Lockable.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private static <U, E> void setElementSerializerAsPriorSerializer(TypeSerializerSnapshot<U> legacySnapshot, TypeSerializer<E> elementSerializer) { TypeSerializerConfigSnapshot<E> elementLegacySnapshot = (TypeSerializerConfigSnapshot<E>) legacySnapshot; elementLegacySnapshot.setPriorSerializer(elementSerializer); }
Example #26
Source File: KvStateRegistryTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<String> snapshotConfiguration() { return null; }
Example #27
Source File: IntListSerializer.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<IntList> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #28
Source File: CollectionInputFormatTest.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<ElementType> snapshotConfiguration() { throw new UnsupportedOperationException(); }
Example #29
Source File: UnionSerializer.java From da-streamingledger with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot snapshotConfiguration() { return new UnionSerializerConfigSnapshot(Arrays.asList(underlyingSerializers)); }
Example #30
Source File: IntPairSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerConfigSnapshot<IntPair> snapshotConfiguration() { throw new UnsupportedOperationException(); }