Class IteratorResultIterator<E>
- Type Parameters:
E- The type of the record returned by the iterator.
- All Implemented Interfaces:
BulkFormat.RecordIterator<E>
BulkFormat.RecordIterator that returns the elements of an iterator, augmented
with position information.-
Constructor Summary
ConstructorsConstructorDescriptionIteratorResultIterator(Iterator<E> records, long offset, long startingSkipCount) Creates a newRecordIteratorreturning the records from the given iterator, augmented with their position information.IteratorResultIterator(Iterator<E> records, long offset, long startingSkipCount, Runnable recycler) Creates a newRecordIteratorreturning the records from the given iterator, augmented with their position information. -
Method Summary
Modifier and TypeMethodDescriptionnext()Gets the next record from the file, together with its position.Methods inherited from class org.apache.flink.connector.file.src.util.RecyclableIterator
releaseBatchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.connector.file.src.reader.BulkFormat.RecordIterator
releaseBatch
-
Constructor Details
-
IteratorResultIterator
Creates a newRecordIteratorreturning the records from the given iterator, augmented with their position information.Each record's
RecordAndPositionwill have the same offset value forRecordAndPosition.getOffset(). The first returned record will have a records-to-skip count ofstartingSkipCount + 1, following the contract that each record needs to point to the position AFTER itself (because a checkpoint taken after the record was emitted needs to resume from after that record). -
IteratorResultIterator
public IteratorResultIterator(Iterator<E> records, long offset, long startingSkipCount, @Nullable Runnable recycler) Creates a newRecordIteratorreturning the records from the given iterator, augmented with their position information. When the iterator is marked as done (viaRecyclableIterator.releaseBatch(), the givenrecycleris called.Each record's
RecordAndPositionwill have the same offset value forRecordAndPosition.getOffset(). The first returned record will have a records-to-skip count ofstartingSkipCount + 1, following the contract that each record needs to point to the position AFTER itself (because a checkpoint taken after the record was emitted needs to resume from after that record).
-
-
Method Details
-
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>
-