public class InternalRowSerializer extends AbstractRowDataSerializer<InternalRow>
InternalRow
.Constructor and Description |
---|
InternalRowSerializer(DataType... types) |
InternalRowSerializer(DataType[] types,
Serializer<?>[] fieldSerializers) |
InternalRowSerializer(RowType rowType) |
Modifier and Type | Method and Description |
---|---|
InternalRow |
copy(InternalRow from)
Creates a deep copy of the given element in a new element.
|
InternalRow |
copyRowData(InternalRow from,
InternalRow reuse) |
InternalRow |
createReuseInstance()
Creates a new instance for reusing.
|
InternalRow |
deserialize(DataInputView source)
De-serializes a record from the given source input view.
|
InternalRow |
deserializeFromPages(AbstractPagedInputView source)
De-serializes a record from the given source paged input view.
|
InternalRow |
deserializeFromPages(InternalRow reuse,
AbstractPagedInputView source)
Reuse version of
PagedTypeSerializer.deserializeFromPages(AbstractPagedInputView) . |
InternalRowSerializer |
duplicate()
Creates a deep copy of this serializer if it is necessary, i.e.
|
boolean |
equals(Object obj) |
DataType[] |
fieldTypes() |
int |
getArity()
Get the number of fields.
|
int |
hashCode() |
InternalRow |
mapFromPages(InternalRow reuse,
AbstractPagedInputView source)
Map a reused record from the given source paged input view.
|
void |
serialize(InternalRow row,
DataOutputView target)
Serializes the given record to the given target output view.
|
int |
serializeToPages(InternalRow row,
AbstractPagedOutputView target)
Serializes the given record to the given target paged output view.
|
void |
skipRecordFromPages(AbstractPagedInputView source)
Skip over bytes of one record from the paged input view, discarding the skipped bytes.
|
BinaryRow |
toBinaryRow(InternalRow row)
Convert
InternalRow into BinaryRow . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
deserializeFromString, serializeToString
public InternalRowSerializer(RowType rowType)
public InternalRowSerializer(DataType... types)
public InternalRowSerializer(DataType[] types, Serializer<?>[] fieldSerializers)
public InternalRowSerializer duplicate()
Serializer
We need this because Serializers might be used in several threads. Stateless serializers are inherently thread-safe while stateful serializers might not be thread-safe.
public void serialize(InternalRow row, DataOutputView target) throws IOException
Serializer
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 InternalRow deserialize(DataInputView source) throws IOException
Serializer
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 InternalRow copy(InternalRow from)
Serializer
from
- The element reuse be copied.public InternalRow copyRowData(InternalRow from, InternalRow reuse)
public int getArity()
AbstractRowDataSerializer
getArity
in class AbstractRowDataSerializer<InternalRow>
public DataType[] fieldTypes()
public BinaryRow toBinaryRow(InternalRow row)
InternalRow
into BinaryRow
. TODO modify it to code gen.toBinaryRow
in class AbstractRowDataSerializer<InternalRow>
public InternalRow createReuseInstance()
PagedTypeSerializer
public int serializeToPages(InternalRow row, AbstractPagedOutputView target) throws IOException
PagedTypeSerializer
BinaryRow
.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 InternalRow deserializeFromPages(AbstractPagedInputView source) throws IOException
PagedTypeSerializer
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 #mapFromPages(T, AbstractPagedInputView)
.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 InternalRow deserializeFromPages(InternalRow reuse, AbstractPagedInputView source) throws IOException
PagedTypeSerializer
PagedTypeSerializer.deserializeFromPages(AbstractPagedInputView)
.IOException
public InternalRow mapFromPages(InternalRow reuse, AbstractPagedInputView source) throws IOException
PagedTypeSerializer
If you choose the zero copy way, you have to deal with the lifecycle of the pages properly.
reuse
- the reused record to be mappedsource
- 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 void skipRecordFromPages(AbstractPagedInputView source) throws IOException
PagedTypeSerializer
IOException
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.