Class NonReusingBlockResettableIterator<T>
java.lang.Object
org.apache.flink.runtime.operators.resettable.NonReusingBlockResettableIterator<T>
- All Implemented Interfaces:
Iterator<T>,MemoryBlockIterator,ResettableIterator<T>
- Direct Known Subclasses:
ReusingBlockResettableIterator
Implementation of an iterator that fetches a block of data into main memory and offers resettable
access to the data in that block.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final SimpleCollectingOutputViewprotected final ArrayList<org.apache.flink.core.memory.MemorySegment>protected final ArrayList<org.apache.flink.core.memory.MemorySegment>protected Tstatic final org.slf4j.Loggerprotected Tprotected booleanprotected intprotected intprotected booleanprotected final RandomAccessInputViewprotected final org.apache.flink.api.common.typeutils.TypeSerializer<T> -
Constructor Summary
ConstructorsConstructorDescriptionNonReusingBlockResettableIterator(MemoryManager memoryManager, Iterator<T> input, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer, int numPages, AbstractInvokable ownerTask) NonReusingBlockResettableIterator(MemoryManager memoryManager, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer, int numPages, AbstractInvokable ownerTask) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method closes the iterator and releases all resources.protected Tprotected TgetNextRecord(T reuse) booleanChecks, whether the input that is blocked by this iterator, has further elements available.booleanhasNext()next()booleanMove the iterator to the next memory block.voidopen()voidremove()voidvoidreset()Resets the iterator.protected booleanwriteNextRecord(T record) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
input
-
nextElement
-
leftOverElement
-
readPhase
protected boolean readPhase -
noMoreBlocks
protected boolean noMoreBlocks -
readView
-
collectingView
-
serializer
-
numRecordsInBuffer
protected int numRecordsInBuffer -
numRecordsReturned
protected int numRecordsReturned -
emptySegments
-
fullSegments
-
closed
protected volatile boolean closed
-
-
Constructor Details
-
NonReusingBlockResettableIterator
public NonReusingBlockResettableIterator(MemoryManager memoryManager, Iterator<T> input, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer, int numPages, AbstractInvokable ownerTask) throws MemoryAllocationException - Throws:
MemoryAllocationException
-
NonReusingBlockResettableIterator
public NonReusingBlockResettableIterator(MemoryManager memoryManager, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer, int numPages, AbstractInvokable ownerTask) throws MemoryAllocationException - Throws:
MemoryAllocationException
-
-
Method Details
-
reopen
- Throws:
IOException
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
reset
public void reset()Description copied from interface:ResettableIteratorResets the iterator.- Specified by:
resetin interfaceResettableIterator<T>
-
nextBlock
Description copied from interface:MemoryBlockIteratorMove the iterator to the next memory block. The next memory block starts at the first element that was not in the block before. A special case is when no record was in the block before, which happens when this function is invoked two times directly in a sequence, without calling hasNext() or next in between. Then the block moves one element.- Specified by:
nextBlockin interfaceMemoryBlockIterator- Returns:
- True if a new memory block was loaded, false if there were no further records and hence no further memory block.
- Throws:
IOException- Thrown, when advancing to the next block failed.
-
hasFurtherInput
public boolean hasFurtherInput()Checks, whether the input that is blocked by this iterator, has further elements available. This method may be used to forecast (for example at the point where a block is full) whether there will be more data (possibly in another block).- Returns:
- True, if there will be more data, false otherwise.
-
close
public void close()This method closes the iterator and releases all resources. This method works both as a regular shutdown and as a canceling method. The method may be called multiple times and will not produce an error. -
open
public void open() -
writeNextRecord
- Throws:
IOException
-
getNextRecord
- Throws:
IOException
-
getNextRecord
- Throws:
IOException
-