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 forWindowKeywhich is composite with aBinaryRowDataand a long value.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWindowKeySerializer.WindowKeySerializerSnapshotATypeSerializerSnapshotforWindowKeySerializer.
-
Field Summary
Fields Modifier and Type Field Description static intWINDOW_IN_BYTES
-
Constructor Summary
Constructors Constructor Description WindowKeySerializer(PagedTypeSerializer<org.apache.flink.table.data.RowData> keySerializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopy(org.apache.flink.core.memory.DataInputView source, org.apache.flink.core.memory.DataOutputView target)WindowKeycopy(WindowKey from)WindowKeycopy(WindowKey from, WindowKey reuse)WindowKeycreateInstance()WindowKeydeserialize(org.apache.flink.core.memory.DataInputView source)WindowKeydeserialize(WindowKey reuse, org.apache.flink.core.memory.DataInputView source)WindowKeydeserializeFromPages(org.apache.flink.runtime.memory.AbstractPagedInputView source)De-serializes a record from the given source paged input view.WindowKeydeserializeFromPages(WindowKey reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source)Reuse version ofPagedTypeSerializer.deserializeFromPages(AbstractPagedInputView).org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>duplicate()booleanequals(Object obj)intgetLength()inthashCode()booleanisImmutableType()WindowKeymapFromPages(WindowKey reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source)Map a reused record from the given source paged input view.voidserialize(WindowKey record, org.apache.flink.core.memory.DataOutputView target)intserializeToPages(WindowKey record, org.apache.flink.runtime.memory.AbstractPagedOutputView target)Actually, the return value is just for saving checkSkipReadForFixLengthPart in the mapFromPages, the cost is very small.voidskipRecordFromPages(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<WindowKey>snapshotConfiguration()
-
-
-
Field Detail
-
WINDOW_IN_BYTES
public static final int WINDOW_IN_BYTES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WindowKeySerializer
public WindowKeySerializer(PagedTypeSerializer<org.apache.flink.table.data.RowData> keySerializer)
-
-
Method Detail
-
isImmutableType
public boolean isImmutableType()
- Specified by:
isImmutableTypein classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
duplicate
public org.apache.flink.api.common.typeutils.TypeSerializer<WindowKey> duplicate()
- Specified by:
duplicatein classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
createInstance
public WindowKey createInstance()
- Specified by:
createInstancein classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
copy
public WindowKey copy(WindowKey from)
- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
copy
public WindowKey copy(WindowKey from, WindowKey reuse)
- Specified by:
copyin classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
getLength
public int getLength()
- Specified by:
getLengthin classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
serialize
public void serialize(WindowKey record, org.apache.flink.core.memory.DataOutputView target) throws IOException
- Specified by:
serializein classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>- Throws:
IOException
-
deserialize
public WindowKey deserialize(org.apache.flink.core.memory.DataInputView source) throws IOException
- Specified by:
deserializein classorg.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:
deserializein classorg.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:
copyin classorg.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:
serializeToPagesin classPagedTypeSerializer<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: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<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:PagedTypeSerializerReuse version ofPagedTypeSerializer.deserializeFromPages(AbstractPagedInputView).- Specified by:
deserializeFromPagesin classPagedTypeSerializer<WindowKey>- Throws:
IOException
-
mapFromPages
public WindowKey mapFromPages(WindowKey reuse, org.apache.flink.runtime.memory.AbstractPagedInputView source) throws IOException
Description 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<WindowKey>- Parameters:
reuse- the reused record to be mappedsource- 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 IOExceptionDescription copied from class:PagedTypeSerializerSkip over bytes of one record from the paged input view, discarding the skipped bytes.- Specified by:
skipRecordFromPagesin classPagedTypeSerializer<WindowKey>- Throws:
IOException
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
hashCode
public int hashCode()
- Specified by:
hashCodein classorg.apache.flink.api.common.typeutils.TypeSerializer<WindowKey>
-
-