Class WindowKeySerializer

java.lang.Object
org.apache.flink.api.common.typeutils.TypeSerializer<T>
org.apache.flink.table.runtime.typeutils.PagedTypeSerializer<WindowKey>
org.apache.flink.table.runtime.typeutils.WindowKeySerializer
All Implemented Interfaces:
Serializable

public class WindowKeySerializer extends PagedTypeSerializer<WindowKey>
Serializer for WindowKey which is composite with a BinaryRowData and a long value.
See Also:
  • Field Details

  • Constructor Details

    • WindowKeySerializer

      public WindowKeySerializer(PagedTypeSerializer<org.apache.flink.table.data.RowData> keySerializer)
  • Method Details

    • isImmutableType

      public boolean isImmutableType()
      Specified by:
      isImmutableType in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
    • duplicate

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

      public WindowKey createInstance()
      Specified by:
      createInstance in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
    • copy

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

      public WindowKey copy(WindowKey from, WindowKey reuse)
      Specified by:
      copy in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
    • getLength

      public int getLength()
      Specified by:
      getLength in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
    • serialize

      public void serialize(WindowKey record, org.apache.flink.core.memory.DataOutputView target) throws IOException
      Specified by:
      serialize in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
      Throws:
      IOException
    • deserialize

      public WindowKey deserialize(org.apache.flink.core.memory.DataInputView source) throws IOException
      Specified by:
      deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
      Throws:
      IOException
    • deserialize

      public WindowKey deserialize(WindowKey reuse, org.apache.flink.core.memory.DataInputView source) throws IOException
      Specified by:
      deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
      Throws:
      IOException
    • 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<WindowKey>
      Throws:
      IOException
    • serializeToPages

      public int serializeToPages(WindowKey record, org.apache.flink.runtime.memory.AbstractPagedOutputView target) throws IOException
      Actually, the return value is just for saving checkSkipReadForFixLengthPart in the mapFromPages, the cost is very small.

      TODO so, we can remove this return value for simplifying interface.

      Specified by:
      serializeToPages in class PagedTypeSerializer<WindowKey>
      Parameters:
      record - 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 WindowKey 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 PagedTypeSerializer.mapFromPages(T, AbstractPagedInputView).
      Specified by:
      deserializeFromPages in class PagedTypeSerializer<WindowKey>
      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.
    • deserializeFromPages

      public WindowKey deserializeFromPages(WindowKey reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source) throws IOException
      Description copied from class: PagedTypeSerializer
      Specified by:
      deserializeFromPages in class PagedTypeSerializer<WindowKey>
      Throws:
      IOException
    • mapFromPages

      public WindowKey mapFromPages(WindowKey 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<WindowKey>
      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<WindowKey>
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Specified by:
      hashCode in class org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
    • snapshotConfiguration

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