@Internal public abstract class TupleSerializerBase<T> extends TypeSerializer<T>
Modifier and Type | Field and Description |
---|---|
protected int |
arity |
protected TypeSerializer<Object>[] |
fieldSerializers |
protected Class<T> |
tupleClass |
Constructor and Description |
---|
TupleSerializerBase(Class<T> tupleClass,
TypeSerializer<?>[] fieldSerializers) |
Modifier and Type | Method and Description |
---|---|
boolean |
canEqual(Object obj)
Returns true if the given object can be equaled with this object.
|
void |
copy(DataInputView source,
DataOutputView target)
Copies exactly one record from the source input view to the target output view.
|
abstract T |
createInstance(Object[] fields) |
abstract T |
createOrReuseInstance(Object[] fields,
T reuse) |
protected abstract TupleSerializerBase<T> |
createSerializerInstance(Class<T> tupleClass,
TypeSerializer<?>[] fieldSerializers) |
CompatibilityResult<T> |
ensureCompatibility(TypeSerializerConfigSnapshot<?> configSnapshot)
This method is deprecated.
|
boolean |
equals(Object obj) |
int |
getArity() |
TypeSerializer<Object>[] |
getFieldSerializers() |
int |
getLength()
Gets the length of the data type, if it is a fix length data type.
|
Class<T> |
getTupleClass() |
int |
hashCode() |
boolean |
isImmutableType()
Gets whether the type is an immutable type.
|
TupleSerializerConfigSnapshot<T> |
snapshotConfiguration()
Snapshots the configuration of this TypeSerializer.
|
copy, copy, createInstance, deserialize, deserialize, duplicate, serialize
protected TypeSerializer<Object>[] fieldSerializers
protected final int arity
public TupleSerializerBase(Class<T> tupleClass, TypeSerializer<?>[] fieldSerializers)
public boolean isImmutableType()
TypeSerializer
isImmutableType
in class TypeSerializer<T>
public int getLength()
TypeSerializer
getLength
in class TypeSerializer<T>
-1
for variable length data types.public int getArity()
public void copy(DataInputView source, DataOutputView target) throws IOException
TypeSerializer
target.write(source, 8);
.copy
in class TypeSerializer<T>
source
- The input view from which to read the record.target
- The target output view to which to write the record.IOException
- Thrown if any of the two views raises an exception.public int hashCode()
hashCode
in class TypeSerializer<T>
public boolean equals(Object obj)
equals
in class TypeSerializer<T>
public boolean canEqual(Object obj)
TypeSerializer
canEqual
in class TypeSerializer<T>
obj
- Object which wants to take part in the equality relationpublic TupleSerializerConfigSnapshot<T> snapshotConfiguration()
TypeSerializer
The snapshot of the TypeSerializer is supposed to contain all information that affects the serialization format of the serializer. The snapshot serves two purposes: First, to reproduce the serializer when the checkpoint/savepoint is restored, and second, to check whether the serialization format is compatible with the serializer used in the restored program.
IMPORTANT: TypeSerializerSnapshots changed after Flink 1.6. Serializers implemented against Flink versions up to 1.6 should still work, but adjust to new model to enable state evolution and be future-proof. See the class-level comments, section "Upgrading TypeSerializers to the new TypeSerializerSnapshot model" for details.
snapshotConfiguration
in class TypeSerializer<T>
null
).TypeSerializerSnapshot.resolveSchemaCompatibility(TypeSerializer)
public CompatibilityResult<T> ensureCompatibility(TypeSerializerConfigSnapshot<?> configSnapshot)
TypeSerializer
TypeSerializerSnapshot.resolveSchemaCompatibility(TypeSerializer)
.
New serializers should not override this method any more! Serializers implemented against Flink versions up to 1.6 should still work, but should adjust to new model to enable state evolution and be future-proof. See the class-level comments, section "Upgrading TypeSerializers to the new TypeSerializerSnapshot model" for details.
ensureCompatibility
in class TypeSerializer<T>
protected abstract TupleSerializerBase<T> createSerializerInstance(Class<T> tupleClass, TypeSerializer<?>[] fieldSerializers)
@VisibleForTesting public TypeSerializer<Object>[] getFieldSerializers()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.