Java Code Examples for org.apache.flink.api.common.typeutils.TypeSerializer#getClass()
The following examples show how to use
org.apache.flink.api.common.typeutils.TypeSerializer#getClass() .
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-CEPplus with Apache License 2.0 | 6 votes |
@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 with Apache License 2.0 | 6 votes |
@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: EitherSerializerConfigSnapshot.java From flink with Apache License 2.0 | 6 votes |
@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 4
Source File: PojoSerializerSnapshot.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer) { if (newSerializer.getClass() != PojoSerializer.class) { return TypeSerializerSchemaCompatibility.incompatible(); } final PojoSerializer<T> newPojoSerializer = (PojoSerializer<T>) newSerializer; final Class<T> previousPojoClass = snapshotData.getPojoClass(); final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = snapshotData.getFieldSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots = snapshotData.getRegisteredSubclassSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots = snapshotData.getNonRegisteredSubclassSerializerSnapshots(); if (previousPojoClass != newPojoSerializer.getPojoClass()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (registeredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (nonRegisteredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingFieldSerializersCompatibility = getCompatibilityOfPreExistingFields(newPojoSerializer, fieldSerializerSnapshots); if (preExistingFieldSerializersCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility = getCompatibilityOfPreExistingRegisteredSubclasses(newPojoSerializer, registeredSubclassSerializerSnapshots); if (preExistingRegistrationsCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (newPojoSerializerIsCompatibleAfterMigration( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, fieldSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleAfterMigration(); } if (newPojoSerializerIsCompatibleWithReconfiguredSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, registeredSubclassSerializerSnapshots, nonRegisteredSubclassSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer( constructReconfiguredPojoSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, registeredSubclassSerializerSnapshots, preExistingRegistrationsCompatibility, nonRegisteredSubclassSerializerSnapshots)); } return TypeSerializerSchemaCompatibility.compatibleAsIs(); }
Example 5
Source File: PojoSerializerSnapshot.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer) { if (newSerializer.getClass() != PojoSerializer.class) { return TypeSerializerSchemaCompatibility.incompatible(); } final PojoSerializer<T> newPojoSerializer = (PojoSerializer<T>) newSerializer; final Class<T> previousPojoClass = snapshotData.getPojoClass(); final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = snapshotData.getFieldSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots = snapshotData.getRegisteredSubclassSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots = snapshotData.getNonRegisteredSubclassSerializerSnapshots(); if (previousPojoClass != newPojoSerializer.getPojoClass()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (registeredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (nonRegisteredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingFieldSerializersCompatibility = getCompatibilityOfPreExistingFields(newPojoSerializer, fieldSerializerSnapshots); if (preExistingFieldSerializersCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility = getCompatibilityOfPreExistingRegisteredSubclasses(newPojoSerializer, registeredSubclassSerializerSnapshots); if (preExistingRegistrationsCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (newPojoSerializerIsCompatibleAfterMigration( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, fieldSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleAfterMigration(); } if (newPojoSerializerIsCompatibleWithReconfiguredSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, registeredSubclassSerializerSnapshots, nonRegisteredSubclassSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer( constructReconfiguredPojoSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, registeredSubclassSerializerSnapshots, preExistingRegistrationsCompatibility, nonRegisteredSubclassSerializerSnapshots)); } return TypeSerializerSchemaCompatibility.compatibleAsIs(); }
Example 6
Source File: PojoSerializerSnapshot.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer) { if (newSerializer.getClass() != PojoSerializer.class) { return TypeSerializerSchemaCompatibility.incompatible(); } final PojoSerializer<T> newPojoSerializer = (PojoSerializer<T>) newSerializer; final Class<T> previousPojoClass = snapshotData.getPojoClass(); final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = snapshotData.getFieldSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots = snapshotData.getRegisteredSubclassSerializerSnapshots(); final LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots = snapshotData.getNonRegisteredSubclassSerializerSnapshots(); if (previousPojoClass != newPojoSerializer.getPojoClass()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (registeredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (nonRegisteredSubclassSerializerSnapshots.hasAbsentKeysOrValues()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingFieldSerializersCompatibility = getCompatibilityOfPreExistingFields(newPojoSerializer, fieldSerializerSnapshots); if (preExistingFieldSerializersCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } final IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility = getCompatibilityOfPreExistingRegisteredSubclasses(newPojoSerializer, registeredSubclassSerializerSnapshots); if (preExistingRegistrationsCompatibility.isIncompatible()) { return TypeSerializerSchemaCompatibility.incompatible(); } if (newPojoSerializerIsCompatibleAfterMigration( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, fieldSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleAfterMigration(); } if (newPojoSerializerIsCompatibleWithReconfiguredSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, preExistingRegistrationsCompatibility, registeredSubclassSerializerSnapshots, nonRegisteredSubclassSerializerSnapshots)) { return TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer( constructReconfiguredPojoSerializer( newPojoSerializer, preExistingFieldSerializersCompatibility, registeredSubclassSerializerSnapshots, preExistingRegistrationsCompatibility, nonRegisteredSubclassSerializerSnapshots)); } return TypeSerializerSchemaCompatibility.compatibleAsIs(); }