public class BinaryRowSerializer extends AbstractRowDataSerializer<BinaryRow>
BinaryRow
.Modifier and Type | Field and Description |
---|---|
static int |
LENGTH_SIZE_IN_BYTES |
Constructor and Description |
---|
BinaryRowSerializer(int numFields) |
Modifier and Type | Method and Description |
---|---|
void |
checkSkipReadForFixLengthPart(AbstractPagedInputView source)
We need skip bytes to read when the remain bytes of current segment is not enough to write
binary row fixed part.
|
BinaryRow |
copy(BinaryRow from)
Creates a deep copy of the given element in a new element.
|
void |
copyFromPagesToView(AbstractPagedInputView source,
DataOutputView target)
Copy a binaryRow which stored in paged input view to output view.
|
BinaryRow |
createInstance() |
BinaryRow |
createReuseInstance()
Creates a new instance for reusing.
|
BinaryRow |
deserialize(BinaryRow reuse,
DataInputView source) |
BinaryRow |
deserialize(DataInputView source)
De-serializes a record from the given source input view.
|
BinaryRow |
deserializeFromPages(AbstractPagedInputView headerLessView)
De-serializes a record from the given source paged input view.
|
BinaryRow |
deserializeFromPages(BinaryRow reuse,
AbstractPagedInputView headerLessView)
Reuse version of
PagedTypeSerializer.deserializeFromPages(AbstractPagedInputView) . |
BinaryRowSerializer |
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 |
getFixedLengthPartSize() |
int |
getSerializedRowFixedPartLength()
Return fixed part length to serialize one row.
|
int |
hashCode() |
BinaryRow |
mapFromPages(BinaryRow reuse,
AbstractPagedInputView headerLessView)
Map a reused record from the given source paged input view.
|
void |
pointTo(int length,
BinaryRow reuse,
AbstractPagedInputView headerLessView)
Point row to memory segments with offset(in the AbstractPagedInputView) and length.
|
void |
serialize(BinaryRow record,
DataOutputView target)
Serializes the given record to the given target output view.
|
int |
serializeToPages(BinaryRow record,
AbstractPagedOutputView headerLessView)
Serializes the given record to the given target paged output view.
|
static void |
serializeWithoutLengthSlow(BinaryRow record,
MemorySegmentWritable out) |
void |
skipRecordFromPages(AbstractPagedInputView headerLessView)
Skip over bytes of one record from the paged input view, discarding the skipped bytes.
|
BinaryRow |
toBinaryRow(BinaryRow rowData)
Convert a
InternalRow to a BinaryRow . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
deserializeFromString, serializeToString
public static final int LENGTH_SIZE_IN_BYTES
public BinaryRowSerializer 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 BinaryRow createInstance()
public BinaryRow copy(BinaryRow from)
Serializer
from
- The element reuse be copied.public void serialize(BinaryRow record, DataOutputView target) throws IOException
Serializer
record
- 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 BinaryRow 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 BinaryRow deserialize(BinaryRow reuse, DataInputView source) throws IOException
IOException
public int getArity()
AbstractRowDataSerializer
getArity
in class AbstractRowDataSerializer<BinaryRow>
public BinaryRow toBinaryRow(BinaryRow rowData) throws IOException
AbstractRowDataSerializer
InternalRow
to a BinaryRow
.toBinaryRow
in class AbstractRowDataSerializer<BinaryRow>
IOException
public BinaryRow createReuseInstance()
PagedTypeSerializer
public int serializeToPages(BinaryRow record, AbstractPagedOutputView headerLessView) throws IOException
PagedTypeSerializer
BinaryRow
.record
- The record to serialize.headerLessView
- 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 static void serializeWithoutLengthSlow(BinaryRow record, MemorySegmentWritable out) throws IOException
IOException
public BinaryRow deserializeFromPages(AbstractPagedInputView headerLessView) 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)
.headerLessView
- 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 BinaryRow deserializeFromPages(BinaryRow reuse, AbstractPagedInputView headerLessView) throws IOException
PagedTypeSerializer
PagedTypeSerializer.deserializeFromPages(AbstractPagedInputView)
.IOException
public BinaryRow mapFromPages(BinaryRow reuse, AbstractPagedInputView headerLessView) 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 mappedheaderLessView
- 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 headerLessView) throws IOException
PagedTypeSerializer
IOException
public void copyFromPagesToView(AbstractPagedInputView source, DataOutputView target) throws IOException
source
- source paged input view where the binary row storedtarget
- the target output view.IOException
public void pointTo(int length, BinaryRow reuse, AbstractPagedInputView headerLessView) throws IOException
length
- row length.reuse
- reuse BinaryRow object.headerLessView
- source memory segments container.IOException
public void checkSkipReadForFixLengthPart(AbstractPagedInputView source) throws IOException
BinaryRow
.IOException
public int getSerializedRowFixedPartLength()
public int getFixedLengthPartSize()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.