Class SpillingResettableMutableObjectIterator<T>
- java.lang.Object
-
- org.apache.flink.runtime.operators.resettable.SpillingResettableMutableObjectIterator<T>
-
- Type Parameters:
T
- The type of record that the iterator handles.
- All Implemented Interfaces:
ResettableMutableObjectIterator<T>
,MutableObjectIterator<T>
public class SpillingResettableMutableObjectIterator<T> extends Object implements ResettableMutableObjectIterator<T>
Implementation of a resettable iterator. While iterating the first time over the data, the iterator writes the records to a spillable buffer. Any subsequent iteration re-reads the data from that buffer.
-
-
Field Summary
Fields Modifier and Type Field Description protected SpillingBuffer
buffer
protected MutableObjectIterator<T>
input
protected DataInputView
inView
protected MemoryManager
memoryManager
protected TypeSerializer<T>
serializer
-
Constructor Summary
Constructors Constructor Description SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, MemoryManager memoryManager, IOManager ioManager, int numPages, AbstractInvokable parentTask)
SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, MemoryManager memoryManager, IOManager ioManager, List<MemorySegment> memory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MemorySegment>
close()
void
consumeAndCacheRemainingData()
T
next()
Gets the next element from the collection.T
next(T reuse)
Gets the next element from the collection.void
open()
void
reset()
Resets the iterator.
-
-
-
Field Detail
-
inView
protected DataInputView inView
-
serializer
protected final TypeSerializer<T> serializer
-
buffer
protected final SpillingBuffer buffer
-
input
protected final MutableObjectIterator<T> input
-
memoryManager
protected final MemoryManager memoryManager
-
-
Constructor Detail
-
SpillingResettableMutableObjectIterator
public SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, MemoryManager memoryManager, IOManager ioManager, int numPages, AbstractInvokable parentTask) throws MemoryAllocationException
- Throws:
MemoryAllocationException
-
SpillingResettableMutableObjectIterator
public SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, MemoryManager memoryManager, IOManager ioManager, List<MemorySegment> memory)
-
-
Method Detail
-
open
public void open()
-
reset
public void reset() throws IOException
Description copied from interface:ResettableMutableObjectIterator
Resets the iterator.- Specified by:
reset
in interfaceResettableMutableObjectIterator<T>
- Throws:
IOException
- May be thrown when the serialization into buffers or the spilling to secondary storage fails.
-
close
public List<MemorySegment> close() throws IOException
- Throws:
IOException
-
next
public T next(T reuse) throws IOException
Description copied from interface:MutableObjectIterator
Gets the next element from the collection. The contents of that next element is put into the given reuse object, if the type is mutable.- Specified by:
next
in interfaceMutableObjectIterator<T>
- Parameters:
reuse
- The target object into which to place next element if E is mutable.- Returns:
- The filled object or
null
if the iterator is exhausted. - Throws:
IOException
- Thrown, if a problem occurred in the underlying I/O layer or in the serialization / deserialization logic
-
next
public T next() throws IOException
Description copied from interface:MutableObjectIterator
Gets the next element from the collection. The iterator implementation must obtain a new instance.- Specified by:
next
in interfaceMutableObjectIterator<T>
- Returns:
- The object or
null
if the iterator is exhausted. - Throws:
IOException
- Thrown, if a problem occurred in the underlying I/O layer or in the serialization / deserialization logic
-
consumeAndCacheRemainingData
public void consumeAndCacheRemainingData() throws IOException
- Throws:
IOException
-
-