public class ExternalSorter<E> extends Object implements Sorter<E>
ExternalSorter is a full fledged sorter. It implements a multi-way merge sort.
Internally, the logic is factored into two or three threads (read, sort, spill) which communicate
through a set of blocking queues, forming a closed loop. Memory is allocated using the MemoryManager interface. Thus the component will not exceed the provided memory limits.| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Shuts down all the threads initiated by this sort/merger.
|
org.apache.flink.util.MutableObjectIterator<E> |
getIterator()
Gets the iterator over this input.
|
boolean |
isClosed() |
static <E> ExternalSorterBuilder<E> |
newBuilder(MemoryManager memoryManager,
AbstractInvokable parentTask,
org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer,
org.apache.flink.api.common.typeutils.TypeComparator<E> comparator)
Creates a builder for the
ExternalSorter. |
static <E> ExternalSorterBuilder<E> |
newBuilder(MemoryManager memoryManager,
TaskInvokable parentTask,
org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer,
org.apache.flink.api.common.typeutils.TypeComparator<E> comparator,
org.apache.flink.api.common.ExecutionConfig executionConfig)
Creates a builder for the
ExternalSorter. |
public void close()
The threads are set to exit directly, but depending on their operation, it may take a while to actually happen. The sorting thread will for example not finish before the current batch is sorted. This method attempts to wait for the working thread to exit. If it is however interrupted, the method exits immediately and is not guaranteed how long the threads continue to exist and occupy resources afterwards.
close 在接口中 Closeableclose 在接口中 AutoCloseableCloseable.close()public boolean isClosed()
public org.apache.flink.util.MutableObjectIterator<E> getIterator() throws InterruptedException
CloseableInputProvidergetIterator 在接口中 CloseableInputProvider<E>InterruptedExceptionpublic static <E> ExternalSorterBuilder<E> newBuilder(MemoryManager memoryManager, TaskInvokable parentTask, org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer, org.apache.flink.api.common.typeutils.TypeComparator<E> comparator, org.apache.flink.api.common.ExecutionConfig executionConfig)
ExternalSorter.public static <E> ExternalSorterBuilder<E> newBuilder(MemoryManager memoryManager, AbstractInvokable parentTask, org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer, org.apache.flink.api.common.typeutils.TypeComparator<E> comparator)
ExternalSorter.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.