Class RowDataSerializer

    • Constructor Summary

      Constructors 
      Constructor Description
      RowDataSerializer​(org.apache.flink.table.types.logical.LogicalType... types)  
      RowDataSerializer​(org.apache.flink.table.types.logical.LogicalType[] types, org.apache.flink.api.common.typeutils.TypeSerializer<?>[] fieldSerializers)  
      RowDataSerializer​(org.apache.flink.table.types.logical.RowType rowType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copy​(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target)  
      org.apache.flink.table.data.RowData copy​(org.apache.flink.table.data.RowData from)  
      org.apache.flink.table.data.RowData copy​(org.apache.flink.table.data.RowData from, org.apache.flink.table.data.RowData reuse)  
      org.apache.flink.table.data.RowData createInstance()  
      org.apache.flink.table.data.RowData deserialize​(org.apache.flink.core.memory.DataInputView source)  
      org.apache.flink.table.data.RowData deserialize​(org.apache.flink.table.data.RowData reuse, org.apache.flink.core.memory.DataInputView source)  
      org.apache.flink.table.data.RowData deserializeFromPages​(org.apache.flink.runtime.memory.AbstractPagedInputView source)
      De-serializes a record from the given source paged input view.
      org.apache.flink.table.data.RowData deserializeFromPages​(org.apache.flink.table.data.RowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source)
      org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> duplicate()  
      boolean equals​(Object obj)  
      int getArity()
      Get the number of fields.
      int getLength()  
      int hashCode()  
      boolean isImmutableType()  
      org.apache.flink.table.data.RowData mapFromPages​(org.apache.flink.table.data.RowData reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source)
      Map a reused record from the given source paged input view.
      void serialize​(org.apache.flink.table.data.RowData row, org.apache.flink.core.memory.DataOutputView target)  
      int serializeToPages​(org.apache.flink.table.data.RowData row, org.apache.flink.runtime.memory.AbstractPagedOutputView target)
      Serializes the given record to the given target paged output view.
      void skipRecordFromPages​(org.apache.flink.runtime.memory.AbstractPagedInputView source)
      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.RowData> snapshotConfiguration()  
      org.apache.flink.table.data.binary.BinaryRowData toBinaryRow​(org.apache.flink.table.data.RowData row)
      Convert RowData into BinaryRowData.
    • Constructor Detail

      • RowDataSerializer

        public RowDataSerializer​(org.apache.flink.table.types.logical.RowType rowType)
      • RowDataSerializer

        public RowDataSerializer​(org.apache.flink.table.types.logical.LogicalType... types)
      • RowDataSerializer

        public RowDataSerializer​(org.apache.flink.table.types.logical.LogicalType[] types,
                                 org.apache.flink.api.common.typeutils.TypeSerializer<?>[] fieldSerializers)
    • Method Detail

      • duplicate

        public org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData> duplicate()
        Specified by:
        duplicate in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • createInstance

        public org.apache.flink.table.data.RowData createInstance()
        Specified by:
        createInstance in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • serialize

        public void serialize​(org.apache.flink.table.data.RowData row,
                              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.RowData>
        Throws:
        IOException
      • deserialize

        public org.apache.flink.table.data.RowData 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.RowData>
        Throws:
        IOException
      • deserialize

        public org.apache.flink.table.data.RowData deserialize​(org.apache.flink.table.data.RowData 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.RowData>
        Throws:
        IOException
      • copy

        public org.apache.flink.table.data.RowData copy​(org.apache.flink.table.data.RowData from)
        Specified by:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • copy

        public org.apache.flink.table.data.RowData copy​(org.apache.flink.table.data.RowData from,
                                                        org.apache.flink.table.data.RowData reuse)
        Specified by:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • 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.RowData>
        Throws:
        IOException
      • toBinaryRow

        public org.apache.flink.table.data.binary.BinaryRowData toBinaryRow​(org.apache.flink.table.data.RowData row)
        Convert RowData into BinaryRowData. TODO modify it to code gen.
        Specified by:
        toBinaryRow in class AbstractRowDataSerializer<org.apache.flink.table.data.RowData>
      • serializeToPages

        public int serializeToPages​(org.apache.flink.table.data.RowData row,
                                    org.apache.flink.runtime.memory.AbstractPagedOutputView target)
                             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.RowData>
        Parameters:
        row - The record to serialize.
        target - 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.
      • deserializeFromPages

        public org.apache.flink.table.data.RowData deserializeFromPages​(org.apache.flink.runtime.memory.AbstractPagedInputView source)
                                                                 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.RowData>
        Parameters:
        source - 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.RowData mapFromPages​(org.apache.flink.table.data.RowData reuse,
                                                                org.apache.flink.runtime.memory.AbstractPagedInputView source)
                                                         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.RowData>
        Parameters:
        reuse - the reused record to be mapped
        source - 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 source)
                                 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.RowData>
        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.RowData>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • isImmutableType

        public boolean isImmutableType()
        Specified by:
        isImmutableType in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • getLength

        public int getLength()
        Specified by:
        getLength in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>
      • snapshotConfiguration

        public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<org.apache.flink.table.data.RowData> snapshotConfiguration()
        Specified by:
        snapshotConfiguration in class org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.table.data.RowData>