Class SingletonResultIterator<E>
- java.lang.Object
-
- org.apache.flink.connector.file.src.util.RecyclableIterator<E>
-
- org.apache.flink.connector.file.src.util.SingletonResultIterator<E>
-
- Type Parameters:
E- The type of the record returned by the iterator.
- All Implemented Interfaces:
BulkFormat.RecordIterator<E>
@PublicEvolving public final class SingletonResultIterator<E> extends RecyclableIterator<E> implements BulkFormat.RecordIterator<E>
A simpleBulkFormat.RecordIteratorthat returns a single value. The iterator is mutable to support object reuse and supports recycling.
-
-
Constructor Summary
Constructors Constructor Description SingletonResultIterator()SingletonResultIterator(Runnable recycler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecordAndPosition<E>next()Gets the next record from the file, together with its position.voidset(E element, long offset, long skipCount)Sets the single record to be returned by this iterator.-
Methods inherited from class org.apache.flink.connector.file.src.util.RecyclableIterator
releaseBatch
-
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.connector.file.src.reader.BulkFormat.RecordIterator
releaseBatch
-
-
-
-
Constructor Detail
-
SingletonResultIterator
public SingletonResultIterator()
-
SingletonResultIterator
public SingletonResultIterator(@Nullable Runnable recycler)
-
-
Method Detail
-
set
public void set(E element, long offset, long skipCount)
Sets the single record to be returned by this iterator. The offset and records-to-skip count will be used as provided here for the returnedRecordAndPosition, meaning they need to point to AFTER this specific record (because a checkpoint taken after the record was processed needs to resume from after this record).
-
next
@Nullable public RecordAndPosition<E> next()
Description copied from interface:BulkFormat.RecordIteratorGets the next record from the file, together with its position.The position information returned with the record point to the record AFTER the returned record, because it defines the point where the reading should resume once the current record is emitted. The position information is put in the source's state when the record is emitted. If a checkpoint is taken directly after the record is emitted, the checkpoint must to describe where to resume the source reading from after that record.
Objects returned by this method may be reused by the iterator. By the time that this method is called again, no object returned from the previous call will be referenced any more. That makes it possible to have a single
MutableRecordAndPositionobject and return the same instance (with updated record and position) on every call.- Specified by:
nextin interfaceBulkFormat.RecordIterator<E>
-
-