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 |
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, waitdeserializeFromString, serializeToStringpublic static final int LENGTH_SIZE_IN_BYTES
public BinaryRowSerializer duplicate()
SerializerWe 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)
Serializerfrom - The element reuse be copied.public void serialize(BinaryRow record, DataOutputView target) throws IOException
Serializerrecord - 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
Serializersource - 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
IOExceptionpublic int getArity()
AbstractRowDataSerializergetArity in class AbstractRowDataSerializer<BinaryRow>public BinaryRow toBinaryRow(BinaryRow rowData) throws IOException
AbstractRowDataSerializerInternalRow to a BinaryRow.toBinaryRow in class AbstractRowDataSerializer<BinaryRow>IOExceptionpublic int serializeToPages(BinaryRow record, AbstractPagedOutputView headerLessView) throws IOException
PagedTypeSerializerBinaryRow.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
IOExceptionpublic BinaryRow deserializeFromPages(AbstractPagedInputView headerLessView) throws IOException
PagedTypeSerializerBinaryRow. 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
PagedTypeSerializerPagedTypeSerializer.deserializeFromPages(AbstractPagedInputView).IOExceptionpublic BinaryRow mapFromPages(BinaryRow reuse, AbstractPagedInputView headerLessView) throws IOException
PagedTypeSerializerIf 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
PagedTypeSerializerIOExceptionpublic void copyFromPagesToView(AbstractPagedInputView source, DataOutputView target) throws IOException
source - source paged input view where the binary row storedtarget - the target output view.IOExceptionpublic void pointTo(int length,
BinaryRow reuse,
AbstractPagedInputView headerLessView)
throws IOException
length - row length.reuse - reuse BinaryRow object.headerLessView - source memory segments container.IOExceptionpublic void checkSkipReadForFixLengthPart(AbstractPagedInputView source) throws IOException
BinaryRow.IOExceptionpublic int getSerializedRowFixedPartLength()
public int getFixedLengthPartSize()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.