Class BinaryRowDataSerializer

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkSkipReadForFixLengthPart​(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.
      void copy​(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target)  
      org.apache.flink.table.data.binary.BinaryRowData copy​(org.apache.flink.table.data.binary.BinaryRowData from)  
      org.apache.flink.table.data.binary.BinaryRowData copy​(org.apache.flink.table.data.binary.BinaryRowData from, org.apache.flink.table.data.binary.BinaryRowData reuse)  
      void copyFromPagesToView​(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.BinaryRowData createInstance()  
      org.apache.flink.table.data.binary.BinaryRowData deserialize​(org.apache.flink.core.memory.DataInputView source)  
      org.apache.flink.table.data.binary.BinaryRowData deserialize​(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.core.memory.DataInputView source)  
      org.apache.flink.table.data.binary.BinaryRowData deserializeFromPages​(org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)
      De-serializes a record from the given source paged input view.
      org.apache.flink.table.data.binary.BinaryRowData deserializeFromPages​(org.apache.flink.table.data.binary.BinaryRowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView headerLessView)
      org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData> duplicate()  
      boolean equals​(Object obj)  
      int getArity()
      Get the number of fields.
      int getFixedLengthPartSize()  
      int getLength()  
      int getSerializedRowFixedPartLength()
      Return fixed part length to serialize one row.
      int hashCode()  
      boolean isImmutableType()  
      org.apache.flink.table.data.binary.BinaryRowData mapFromPages​(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.
      void pointTo​(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.
      void serialize​(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.DataOutputView target)  
      int serializeToPages​(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 void serializeWithoutLengthSlow​(org.apache.flink.table.data.binary.BinaryRowData record, org.apache.flink.core.memory.MemorySegmentWritable out)  
      void skipRecordFromPages​(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.BinaryRowData toBinaryRow​(org.apache.flink.table.data.binary.BinaryRowData rowData)
      Convert a RowData to a BinaryRowData.
    • Constructor Detail

      • BinaryRowDataSerializer

        public BinaryRowDataSerializer​(int numFields)
    • Method Detail

      • isImmutableType

        public boolean isImmutableType()
        Specified by:
        isImmutableType in class org.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:
        duplicate in class org.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:
        createInstance in class org.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:
        copy in class org.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:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
      • getLength

        public int getLength()
        Specified by:
        getLength in class org.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:
        serialize in class org.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:
        deserialize in class org.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:
        deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<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 IOException
        Description copied from class: PagedTypeSerializer
        Serializes 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.g BinaryRowData.
        Specified by:
        serializeToPages in class PagedTypeSerializer<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 IOException
        Description copied from class: PagedTypeSerializer
        De-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.g BinaryRowData. 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:
        deserializeFromPages in class PagedTypeSerializer<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.
      • 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 IOException
        Description copied from class: PagedTypeSerializer
        Map 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:
        mapFromPages in class PagedTypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
        Parameters:
        reuse - the reused record to be mapped
        headerLessView - 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 IOException
        Description copied from class: PagedTypeSerializer
        Skip over bytes of one record from the paged input view, discarding the skipped bytes.
        Specified by:
        skipRecordFromPages in class PagedTypeSerializer<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 IOException
        Copy a binaryRow which stored in paged input view to output view.
        Parameters:
        source - source paged input view where the binary row stored
        target - 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 IOException
        Point 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 IOException
        We need skip bytes to read when the remain bytes of current segment is not enough to write binary row fixed part. See BinaryRowData.
        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:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
        Throws:
        IOException
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class org.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:
        snapshotConfiguration in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.binary.BinaryRowData>