I
- Input typeO
- Mapped output typepublic class RecordMapperWrapperRecordIterator<I,O> extends Object implements BulkFormat.RecordIterator<O>
BulkFormat.RecordIterator
that wraps another iterator and performs the mapping of the records. You can use wrapReader(BulkFormat.Reader, RecordMapper)
to wrap a whole reader.Modifier and Type | Class and Description |
---|---|
static interface |
RecordMapperWrapperRecordIterator.RecordMapper<I,O>
Record mapper definition.
|
Constructor and Description |
---|
RecordMapperWrapperRecordIterator(BulkFormat.RecordIterator<I> wrapped,
RecordMapperWrapperRecordIterator.RecordMapper<I,O> mapper) |
Modifier and Type | Method and Description |
---|---|
RecordAndPosition<O> |
next()
Gets the next record from the file, together with its position.
|
void |
releaseBatch()
Releases the batch that this iterator iterated over.
|
static <I,O> BulkFormat.Reader<O> |
wrapReader(BulkFormat.Reader<I> wrappedReader,
RecordMapperWrapperRecordIterator.RecordMapper<I,O> recordMapper)
Wrap a
BulkFormat.Reader applying a RecordMapperWrapperRecordIterator.RecordMapper on the returned iterator. |
public RecordMapperWrapperRecordIterator(BulkFormat.RecordIterator<I> wrapped, RecordMapperWrapperRecordIterator.RecordMapper<I,O> mapper)
public RecordAndPosition<O> next()
BulkFormat.RecordIterator
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.
next
in interface BulkFormat.RecordIterator<O>
public void releaseBatch()
BulkFormat.RecordIterator
releaseBatch
in interface BulkFormat.RecordIterator<O>
public static <I,O> BulkFormat.Reader<O> wrapReader(BulkFormat.Reader<I> wrappedReader, RecordMapperWrapperRecordIterator.RecordMapper<I,O> recordMapper)
BulkFormat.Reader
applying a RecordMapperWrapperRecordIterator.RecordMapper
on the returned iterator.I
- Input typeO
- Mapped output typeCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.