public class BaseRowSerializer extends AbstractRowSerializer<BaseRow>
Modifier and Type | Class and Description |
---|---|
static class |
BaseRowSerializer.BaseRowSerializerSnapshot
|
Constructor and Description |
---|
BaseRowSerializer(ExecutionConfig config,
LogicalType... types) |
BaseRowSerializer(ExecutionConfig config,
RowType rowType) |
BaseRowSerializer(LogicalType[] types,
TypeSerializer[] fieldSerializers) |
Modifier and Type | Method and Description |
---|---|
BaseRow |
copy(BaseRow from)
Creates a deep copy of the given element in a new element.
|
BaseRow |
copy(BaseRow from,
BaseRow reuse)
Creates a copy from the given element.
|
void |
copy(DataInputView source,
DataOutputView target)
Copies exactly one record from the source input view to the target output view.
|
BaseRow |
createInstance()
Creates a new instance of the data type.
|
BaseRow |
deserialize(BaseRow reuse,
DataInputView source)
De-serializes a record from the given source input view into the given reuse record instance if mutable.
|
BaseRow |
deserialize(DataInputView source)
De-serializes a record from the given source input view.
|
BaseRow |
deserializeFromPages(AbstractPagedInputView source)
De-serializes a record from the given source paged input view.
|
BaseRow |
deserializeFromPages(BaseRow reuse,
AbstractPagedInputView source)
Reuse version of
AbstractRowSerializer.deserializeFromPages(AbstractPagedInputView) . |
TypeSerializer<BaseRow> |
duplicate()
Creates a deep copy of this serializer if it is necessary, i.e.
|
boolean |
equals(Object obj) |
int |
getArity()
Get the number of fields.
|
int |
getLength()
Gets the length of the data type, if it is a fix length data type.
|
int |
hashCode() |
boolean |
isImmutableType()
Gets whether the type is an immutable type.
|
BaseRow |
mapFromPages(AbstractPagedInputView source)
Map a record from the given source paged input view.
|
BaseRow |
mapFromPages(BaseRow reuse,
AbstractPagedInputView source)
Reuse version of
AbstractRowSerializer.mapFromPages(AbstractPagedInputView) . |
void |
serialize(BaseRow row,
DataOutputView target)
Serializes the given record to the given target output view.
|
int |
serializeToPages(BaseRow row,
AbstractPagedOutputView target)
Serializes the given record to the given target paged output view.
|
TypeSerializerSnapshot<BaseRow> |
snapshotConfiguration()
Snapshots the configuration of this TypeSerializer.
|
BinaryRow |
toBinaryRow(BaseRow row)
Convert base row to binary row.
|
public BaseRowSerializer(ExecutionConfig config, RowType rowType)
public BaseRowSerializer(ExecutionConfig config, LogicalType... types)
public BaseRowSerializer(LogicalType[] types, TypeSerializer[] fieldSerializers)
public TypeSerializer<BaseRow> duplicate()
TypeSerializer
duplicate
in class TypeSerializer<BaseRow>
public BaseRow createInstance()
TypeSerializer
createInstance
in class TypeSerializer<BaseRow>
public void serialize(BaseRow row, DataOutputView target) throws IOException
TypeSerializer
serialize
in class TypeSerializer<BaseRow>
row
- The record to serialize.target
- The output view to write the serialized data to.IOException
- Thrown, if the serialization encountered an I/O related error. Typically raised by the
output view, which may have an underlying I/O channel to which it delegates.public BaseRow deserialize(DataInputView source) throws IOException
TypeSerializer
deserialize
in class TypeSerializer<BaseRow>
source
- The input view from which to read the data.IOException
- Thrown, if the de-serialization encountered an I/O related error. Typically raised by the
input view, which may have an underlying I/O channel from which it reads.public BaseRow deserialize(BaseRow reuse, DataInputView source) throws IOException
TypeSerializer
deserialize
in class TypeSerializer<BaseRow>
reuse
- The record instance into which to de-serialize the data.source
- The input view from which to read the data.IOException
- Thrown, if the de-serialization encountered an I/O related error. Typically raised by the
input view, which may have an underlying I/O channel from which it reads.public BaseRow copy(BaseRow from)
TypeSerializer
copy
in class TypeSerializer<BaseRow>
from
- The element reuse be copied.public BaseRow copy(BaseRow from, BaseRow reuse)
TypeSerializer
copy
in class TypeSerializer<BaseRow>
from
- The element to be copied.reuse
- The element to be reused. May or may not be used.public void copy(DataInputView source, DataOutputView target) throws IOException
TypeSerializer
target.write(source, 8);
.copy
in class TypeSerializer<BaseRow>
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 getArity()
AbstractRowSerializer
getArity
in class AbstractRowSerializer<BaseRow>
public BinaryRow toBinaryRow(BaseRow row)
toBinaryRow
in class AbstractRowSerializer<BaseRow>
public int serializeToPages(BaseRow row, AbstractPagedOutputView target) throws IOException
AbstractRowSerializer
BinaryRow
.serializeToPages
in class AbstractRowSerializer<BaseRow>
row
- The record to serialize.target
- The output view to write the serialized data to.IOException
- Thrown, if the serialization encountered an I/O related error.
Typically raised by the output view, which may have an underlying
I/O channel to which it delegates.public BaseRow deserializeFromPages(AbstractPagedInputView source) throws IOException
AbstractRowSerializer
BinaryRow
. Typically, the content read from source should be copied out when
de-serializing, and we are not expecting the underlying data from source is reused. If you
have such requirement, see AbstractRowSerializer.mapFromPages(AbstractPagedInputView)
.deserializeFromPages
in class AbstractRowSerializer<BaseRow>
source
- The input view from which to read the data.IOException
- Thrown, if the de-serialization encountered an I/O related error.
Typically raised by the input view, which may have an underlying I/O
channel from which it reads.public BaseRow deserializeFromPages(BaseRow reuse, AbstractPagedInputView source) throws IOException
AbstractRowSerializer
AbstractRowSerializer.deserializeFromPages(AbstractPagedInputView)
.deserializeFromPages
in class AbstractRowSerializer<BaseRow>
IOException
public BaseRow mapFromPages(AbstractPagedInputView source) throws IOException
AbstractRowSerializer
If you choose the zero copy way, you have to deal with the lifecycle of the pages properly.
mapFromPages
in class AbstractRowSerializer<BaseRow>
source
- The input view from which to read the data.IOException
- Thrown, if the de-serialization encountered an I/O related error.
Typically raised by the input view, which may have an underlying I/O
channel from which it reads.public BaseRow mapFromPages(BaseRow reuse, AbstractPagedInputView source) throws IOException
AbstractRowSerializer
AbstractRowSerializer.mapFromPages(AbstractPagedInputView)
.mapFromPages
in class AbstractRowSerializer<BaseRow>
IOException
public boolean equals(Object obj)
equals
in class TypeSerializer<BaseRow>
public int hashCode()
hashCode
in class TypeSerializer<BaseRow>
public boolean isImmutableType()
TypeSerializer
isImmutableType
in class TypeSerializer<BaseRow>
public int getLength()
TypeSerializer
getLength
in class TypeSerializer<BaseRow>
-1
for variable length data types.public TypeSerializerSnapshot<BaseRow> 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<BaseRow>
null
).TypeSerializerSnapshot.resolveSchemaCompatibility(TypeSerializer)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.