Java Code Examples for org.apache.flink.api.common.typeutils.CompositeTypeSerializerUtil#delegateCompatibilityCheckToNewSnapshot()

The following examples show how to use org.apache.flink.api.common.typeutils.CompositeTypeSerializerUtil#delegateCompatibilityCheckToNewSnapshot() . 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: EitherSerializerConfigSnapshot.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public TypeSerializerSchemaCompatibility<Either<L, R>> resolveSchemaCompatibility(
		TypeSerializer<Either<L, R>> newSerializer) {

	// this class was shared between the Java Either Serializer and the
	// Scala Either serializer
	if (newSerializer.getClass() == EitherSerializer.class) {
		List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> nestedSerializersAndConfigs = getNestedSerializersAndConfigs();
		return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
			newSerializer,
			new JavaEitherSerializerSnapshot<>(),
			nestedSerializersAndConfigs.get(0).f1,
			nestedSerializersAndConfigs.get(1).f1);
	}
	else {
		// fall back to the backwards compatibility path
		return super.resolveSchemaCompatibility(newSerializer);
	}
}
 
Example 2
Source File: EitherSerializerConfigSnapshot.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public TypeSerializerSchemaCompatibility<Either<L, R>> resolveSchemaCompatibility(
		TypeSerializer<Either<L, R>> newSerializer) {

	// this class was shared between the Java Either Serializer and the
	// Scala Either serializer
	if (newSerializer.getClass() == EitherSerializer.class) {
		List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> nestedSerializersAndConfigs = getNestedSerializersAndConfigs();
		return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
			newSerializer,
			new JavaEitherSerializerSnapshot<>(),
			nestedSerializersAndConfigs.get(0).f1,
			nestedSerializersAndConfigs.get(1).f1);
	}
	else {
		// fall back to the backwards compatibility path
		return super.resolveSchemaCompatibility(newSerializer);
	}
}
 
Example 3
Source File: TtlStateFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@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 4
Source File: TtlStateFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@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 5
Source File: ArrayListSerializer.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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 6
Source File: TraversableSerializerConfigSnapshot.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer) {
	TraversableSerializer<T, E> previousSerializer = (TraversableSerializer<T, E>) restoreSerializer();
	TraversableSerializerSnapshot<T, E> newCompositeSnapshot =
			new TraversableSerializerSnapshot<>(previousSerializer.cbfCode());

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
			newSerializer,
			newCompositeSnapshot,
			getSingleNestedSerializerAndConfig().f1
	);
}
 
Example 7
Source File: NFA.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<MigratedNFA<T>> resolveSchemaCompatibility(TypeSerializer<MigratedNFA<T>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new MigratedNFASerializerSnapshot<>(),
		getNestedSerializerSnapshots());
}
 
Example 8
Source File: StreamElementSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<StreamElement> resolveSchemaCompatibility(TypeSerializer<StreamElement> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new StreamElementSerializerSnapshot<>(),
		getSingleNestedSerializerAndConfig().f1);
}
 
Example 9
Source File: ScalaTrySerializerConfigSnapshot.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<Try<E>> resolveSchemaCompatibility(TypeSerializer<Try<E>> newSerializer) {

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new ScalaTrySerializerSnapshot<>(),
		getNestedSerializersAndConfigs().get(0).f1,
		getNestedSerializersAndConfigs().get(1).f1);
}
 
Example 10
Source File: TimerSerializer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<TimerHeapInternalTimer<K, N>> resolveSchemaCompatibility(
		TypeSerializer<TimerHeapInternalTimer<K, N>> newSerializer) {

	final TypeSerializerSnapshot<?>[] nestedSnapshots = getNestedSerializersAndConfigs()
		.stream()
		.map(t -> t.f1)
		.toArray(TypeSerializerSnapshot[]::new);

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new TimerSerializerSnapshot<>(),
		nestedSnapshots
	);
}
 
Example 11
Source File: NullableSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer) {
	NullableSerializer<T> previousSerializer = (NullableSerializer<T>) restoreSerializer();
	NullableSerializerSnapshot<T> newCompositeSnapshot = new NullableSerializerSnapshot<>(previousSerializer.nullPaddingLength());

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		newCompositeSnapshot,
		getSingleNestedSerializerAndConfig().f1
	);
}
 
Example 12
Source File: IntervalJoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<BufferEntry<T>> resolveSchemaCompatibility(TypeSerializer<BufferEntry<T>> newSerializer) {

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new BufferEntrySerializerSnapshot<>(),
		getSingleNestedSerializerAndConfig().f1);
}
 
Example 13
Source File: ScalaOptionSerializerConfigSnapshot.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<Option<E>> resolveSchemaCompatibility(TypeSerializer<Option<E>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new ScalaOptionSerializerSnapshot<>(),
		getSingleNestedSerializerAndConfig().f1);
}
 
Example 14
Source File: SharedBuffer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<SharedBuffer<V>> resolveSchemaCompatibility(TypeSerializer<SharedBuffer<V>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new SharedBufferSerializerSnapshot<>(),
		getNestedSerializerSnapshots());
}
 
Example 15
Source File: SharedBuffer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<SharedBuffer<V>> resolveSchemaCompatibility(TypeSerializer<SharedBuffer<V>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new SharedBufferSerializerSnapshot<>(),
		getNestedSerializerSnapshots());
}
 
Example 16
Source File: NFA.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<MigratedNFA<T>> resolveSchemaCompatibility(TypeSerializer<MigratedNFA<T>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new MigratedNFASerializerSnapshot<>(),
		getNestedSerializerSnapshots());
}
 
Example 17
Source File: RowSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<Row> resolveSchemaCompatibility(TypeSerializer<Row> newSerializer) {
	TypeSerializerSnapshot<?>[] nestedSnapshots = getNestedSerializersAndConfigs()
		.stream()
		.map(t -> t.f1)
		.toArray(TypeSerializerSnapshot[]::new);

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new RowSerializerSnapshot(),
		nestedSnapshots);
}
 
Example 18
Source File: RowSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<Row> resolveSchemaCompatibility(TypeSerializer<Row> newSerializer) {
	TypeSerializerSnapshot<?>[] nestedSnapshots = getNestedSerializersAndConfigs()
		.stream()
		.map(t -> t.f1)
		.toArray(TypeSerializerSnapshot[]::new);

	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new RowSerializerSnapshot(),
		nestedSnapshots);
}
 
Example 19
Source File: ScalaOptionSerializerConfigSnapshot.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<Option<E>> resolveSchemaCompatibility(TypeSerializer<Option<E>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new ScalaOptionSerializerSnapshot<>(),
		getSingleNestedSerializerAndConfig().f1);
}
 
Example 20
Source File: SharedBuffer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeSerializerSchemaCompatibility<SharedBuffer<V>> resolveSchemaCompatibility(TypeSerializer<SharedBuffer<V>> newSerializer) {
	return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
		newSerializer,
		new SharedBufferSerializerSnapshot<>(),
		getNestedSerializerSnapshots());
}