Class SortingDataInput<T,K>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.sort.SortingDataInput<T,K>
-
- Type Parameters:
T
- The type of the value in incomingStreamRecords
.K
- The type of the key.
- All Implemented Interfaces:
Closeable
,AutoCloseable
,AvailabilityProvider
,PushingAsyncDataInput<T>
,StreamTaskInput<T>
public final class SortingDataInput<T,K> extends Object implements StreamTaskInput<T>
AStreamTaskInput
which sorts in the incoming records from a chained input. It postpones emitting the records until it receivesDataInputStatus.END_OF_INPUT
from the chained input. After it is done it emits a single record at a time from the sorter.The sorter uses binary comparison of keys, which are extracted and serialized when received from the chained input. Moreover the timestamps of incoming records are used for secondary ordering. For the comparison it uses either
FixedLengthByteKeyComparator
if the length of the serialized key is constant, orVariableLengthByteKeyComparator
otherwise.Watermarks, watermark statuses, nor latency markers are propagated downstream as they do not make sense with buffered records. The input emits the largest watermark seen after all records.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelper
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.runtime.io.PushingAsyncDataInput
PushingAsyncDataInput.DataOutput<T>
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE
-
Fields inherited from interface org.apache.flink.streaming.runtime.io.StreamTaskInput
UNSPECIFIED
-
-
Constructor Summary
Constructors Constructor Description SortingDataInput(StreamTaskInput<T> wrappedInput, TypeSerializer<T> typeSerializer, TypeSerializer<K> keySerializer, KeySelector<T,K> keySelector, MemoryManager memoryManager, IOManager ioManager, boolean objectReuse, double managedMemoryFraction, Configuration taskManagerConfiguration, TaskInvokable containingTask, ExecutionConfig executionConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
DataInputStatus
emitNext(PushingAsyncDataInput.DataOutput<T> output)
Pushes elements to the output from current data input, and returns the input status to indicate whether there are more available data in current input.CompletableFuture<?>
getAvailableFuture()
int
getInputIndex()
Returns the input index of this input.CompletableFuture<Void>
prepareSnapshot(ChannelStateWriter channelStateWriter, long checkpointId)
Prepares to spill the in-flight input buffers as checkpoint snapshot.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
isApproximatelyAvailable, isAvailable
-
-
-
-
Constructor Detail
-
SortingDataInput
public SortingDataInput(StreamTaskInput<T> wrappedInput, TypeSerializer<T> typeSerializer, TypeSerializer<K> keySerializer, KeySelector<T,K> keySelector, MemoryManager memoryManager, IOManager ioManager, boolean objectReuse, double managedMemoryFraction, Configuration taskManagerConfiguration, TaskInvokable containingTask, ExecutionConfig executionConfig)
-
-
Method Detail
-
getInputIndex
public int getInputIndex()
Description copied from interface:StreamTaskInput
Returns the input index of this input.- Specified by:
getInputIndex
in interfaceStreamTaskInput<T>
-
prepareSnapshot
public CompletableFuture<Void> prepareSnapshot(ChannelStateWriter channelStateWriter, long checkpointId) throws CheckpointException
Description copied from interface:StreamTaskInput
Prepares to spill the in-flight input buffers as checkpoint snapshot.- Specified by:
prepareSnapshot
in interfaceStreamTaskInput<T>
- Throws:
CheckpointException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
emitNext
public DataInputStatus emitNext(PushingAsyncDataInput.DataOutput<T> output) throws Exception
Description copied from interface:PushingAsyncDataInput
Pushes elements to the output from current data input, and returns the input status to indicate whether there are more available data in current input.This method should be non blocking.
- Specified by:
emitNext
in interfacePushingAsyncDataInput<T>
- Throws:
Exception
-
getAvailableFuture
public CompletableFuture<?> getAvailableFuture()
- Specified by:
getAvailableFuture
in interfaceAvailabilityProvider
- Returns:
- a future that is completed if the respective provider is available.
-
-