Interface BulkFormat.RecordIterator<T>
-
- Type Parameters:
T
- The type of the record.
- All Known Implementing Classes:
ArrayResultIterator
,ColumnarRowIterator
,IteratorResultIterator
,RecordMapperWrapperRecordIterator
,RecyclableIterator
,SingletonResultIterator
- Enclosing interface:
- BulkFormat<T,SplitT extends FileSourceSplit>
public static interface BulkFormat.RecordIterator<T>
An iterator over records with their position in the file. The iterator is closeable to support clean resource release and recycling.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RecordAndPosition<T>
next()
Gets the next record from the file, together with its position.void
releaseBatch()
Releases the batch that this iterator iterated over.
-
-
-
Method Detail
-
next
@Nullable RecordAndPosition<T> next()
Gets 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
MutableRecordAndPosition
object and return the same instance (with updated record and position) on every call.
-
releaseBatch
void releaseBatch()
Releases the batch that this iterator iterated over. This is not supposed to close the reader and its resources, but is simply a signal that this iterator is no used any more. This method can be used as a hook to recycle/reuse heavyweight object structures.
-
-