Class BinaryRowDataSerializer
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.TypeSerializer<T>
-
- org.apache.flink.table.runtime.typeutils.PagedTypeSerializer<T>
-
- org.apache.flink.table.runtime.typeutils.AbstractRowDataSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
- org.apache.flink.table.runtime.typeutils.BinaryRowDataSerializer
-
- All Implemented Interfaces:
Serializable
@Internal public class BinaryRowDataSerializer extends AbstractRowDataSerializer<org.apache.flink.table.data.binary.BinaryRowData>
Serializer forBinaryRowData.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBinaryRowDataSerializer.BinaryRowDataSerializerSnapshotTypeSerializerSnapshotforBinaryRowDataSerializer.
-
Field Summary
Fields Modifier and Type Field Description static intLENGTH_SIZE_IN_BYTES
-
Constructor Summary
Constructors Constructor Description BinaryRowDataSerializer(int numFields)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckSkipReadForFixLengthPart(org.apache.flink.runtime.memory.AbstractPagedInputView source)We need skip bytes to read when the remain bytes of current segment is not enough to write binary row fixed part.voidcopy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target)org.apache.flink.table.data.binary.BinaryRowDatacopy(org.apache.flink.table.data.binary.BinaryRowData from)org.apache.flink.table.data.binary.BinaryRowDatacopy(org.apache.flink.table.data.binary.BinaryRowData from, org.apache.flink.table.data.binary.BinaryRowData reuse)voidcopyFromPagesToView(org.apache.flink.runtime.memory.AbstractPagedInputView source, org.apache.flink.core.memory.DataOutputView target)Copy a binaryRow which stored in paged input view to output view.org.apache.flink.table.data.binary.BinaryRowDatacreateInstance()org.apache.flink.table.data.binary.BinaryRowDatadeserialize(org.apache.flink.core.memory.DataInputView source)org.apache.flink.table.data.binary.BinaryRowDatadeserialize(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.core.memory.DataInputView source)org.apache.flink.table.data.binary.BinaryRowDatadeserializeFromPages(org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)De-serializes a record from the given source paged input view.org.apache.flink.table.data.binary.BinaryRowDatadeserializeFromPages(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)Reuse version ofPagedTypeSerializer.deserializeFromPages(AbstractPagedInputView).org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>duplicate()booleanequals(Object obj)intgetArity()Get the number of fields.intgetFixedLengthPartSize()intgetLength()intgetSerializedRowFixedPartLength()Return fixed part length to serialize one row.inthashCode()booleanisImmutableType()org.apache.flink.table.data.binary.BinaryRowDatamapFromPages(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)Map a reused record from the given source paged input view.voidpointTo(int length, org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)Point row to memory segments with offset(in the AbstractPagedInputView) and length.voidserialize(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.DataOutputView target)intserializeToPages(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.runtime.memory.AbstractPagedOutputView headerLessView)Serializes the given record to the given target paged output view.static voidserializeWithoutLengthSlow(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.MemorySegmentWritable out)voidskipRecordFromPages(org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)Skip over bytes of one record from the paged input view, discarding the skipped bytes.org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<org.apache.flink.table.data.binary.BinaryRowData>snapshotConfiguration()org.apache.flink.table.data.binary.BinaryRowDatatoBinaryRow(org.apache.flink.table.data.binary.BinaryRowData rowData)Convert aRowDatato aBinaryRowData.
-
-
-
Field Detail
-
LENGTH_SIZE_IN_BYTES
public static final int LENGTH_SIZE_IN_BYTES
- See Also:
- Constant Field Values
-
-
Method Detail
-
isImmutableType
public boolean isImmutableType()
- Specified by:
isImmutableTypein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
duplicate
public org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData> duplicate()
- Specified by:
duplicatein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
createInstance
public org.apache.flink.table.data.binary.BinaryRowData createInstance()
- Specified by:
createInstancein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
copy
public org.apache.flink.table.data.binary.BinaryRowData copy(org.apache.flink.table.data.binary.BinaryRowData from)
- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
copy
public org.apache.flink.table.data.binary.BinaryRowData copy(org.apache.flink.table.data.binary.BinaryRowData from, org.apache.flink.table.data.binary.BinaryRowData reuse)- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
getLength
public int getLength()
- Specified by:
getLengthin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
serialize
public void serialize(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.DataOutputView target) throws IOException- Specified by:
serializein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
deserialize
public org.apache.flink.table.data.binary.BinaryRowData deserialize(org.apache.flink.core.memory.DataInputView source) throws IOException- Specified by:
deserializein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
deserialize
public org.apache.flink.table.data.binary.BinaryRowData deserialize(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.core.memory.DataInputView source) throws IOException- Specified by:
deserializein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
getArity
public int getArity()
Description copied from class:AbstractRowDataSerializerGet the number of fields.- Specified by:
getArityin classAbstractRowDataSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
toBinaryRow
public org.apache.flink.table.data.binary.BinaryRowData toBinaryRow(org.apache.flink.table.data.binary.BinaryRowData rowData) throws IOExceptionDescription copied from class:AbstractRowDataSerializerConvert aRowDatato aBinaryRowData.- Specified by:
toBinaryRowin classAbstractRowDataSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
serializeToPages
public int serializeToPages(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.runtime.memory.AbstractPagedOutputView headerLessView) throws IOExceptionDescription copied from class:PagedTypeSerializerSerializes the given record to the given target paged output view. Some implementations may skip some bytes if current page does not have enough space left, .e.gBinaryRowData.- Specified by:
serializeToPagesin classPagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Parameters:
record- The record to serialize.headerLessView- The output view to write the serialized data to.- Returns:
- Returns the skipped number of bytes.
- Throws:
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.
-
serializeWithoutLengthSlow
public static void serializeWithoutLengthSlow(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.MemorySegmentWritable out) throws IOException- Throws:
IOException
-
deserializeFromPages
public org.apache.flink.table.data.binary.BinaryRowData deserializeFromPages(org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView) throws IOExceptionDescription copied from class:PagedTypeSerializerDe-serializes a record from the given source paged input view. For consistency with serialize format, some implementations may need to skip some bytes of source before de-serializing, .e.gBinaryRowData. 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).- Specified by:
deserializeFromPagesin classPagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Parameters:
headerLessView- The input view from which to read the data.- Returns:
- The de-serialized element.
- Throws:
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.
-
deserializeFromPages
public org.apache.flink.table.data.binary.BinaryRowData deserializeFromPages(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView) throws IOExceptionDescription copied from class:PagedTypeSerializerReuse version ofPagedTypeSerializer.deserializeFromPages(AbstractPagedInputView).- Specified by:
deserializeFromPagesin classPagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
mapFromPages
public org.apache.flink.table.data.binary.BinaryRowData mapFromPages(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView) throws IOExceptionDescription copied from class:PagedTypeSerializerMap a reused record from the given source paged input view. This method provides a possibility to achieve zero copy when de-serializing. You can either choose copy or not copy the content read from source, but we encourage to make it zero copy.If you choose the zero copy way, you have to deal with the lifecycle of the pages properly.
- Specified by:
mapFromPagesin classPagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Parameters:
reuse- the reused record to be mappedheaderLessView- The input view from which to read the data.- Returns:
- The mapped record.
- Throws:
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.
-
skipRecordFromPages
public void skipRecordFromPages(org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView) throws IOExceptionDescription copied from class:PagedTypeSerializerSkip over bytes of one record from the paged input view, discarding the skipped bytes.- Specified by:
skipRecordFromPagesin classPagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
copyFromPagesToView
public void copyFromPagesToView(org.apache.flink.runtime.memory.AbstractPagedInputView source, org.apache.flink.core.memory.DataOutputView target) throws IOExceptionCopy a binaryRow which stored in paged input view to output view.- Parameters:
source- source paged input view where the binary row storedtarget- the target output view.- Throws:
IOException
-
pointTo
public void pointTo(int length, org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView) throws IOExceptionPoint row to memory segments with offset(in the AbstractPagedInputView) and length.- Parameters:
length- row length.reuse- reuse BinaryRowData object.headerLessView- source memory segments container.- Throws:
IOException
-
checkSkipReadForFixLengthPart
public void checkSkipReadForFixLengthPart(org.apache.flink.runtime.memory.AbstractPagedInputView source) throws IOExceptionWe need skip bytes to read when the remain bytes of current segment is not enough to write binary row fixed part. SeeBinaryRowData.- Throws:
IOException
-
getSerializedRowFixedPartLength
public int getSerializedRowFixedPartLength()
Return fixed part length to serialize one row.
-
getFixedLengthPartSize
public int getFixedLengthPartSize()
-
copy
public void copy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target) throws IOException- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>- Throws:
IOException
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
hashCode
public int hashCode()
- Specified by:
hashCodein classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
snapshotConfiguration
public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<org.apache.flink.table.data.binary.BinaryRowData> snapshotConfiguration()
- Specified by:
snapshotConfigurationin classorg.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
-
-