@Internal public final class FileRecords<T> extends Object implements RecordsWithSplitIds<RecordAndPosition<T>>
This is essentially a slim wrapper around the BulkFormat.RecordIterator
that only adds
information about the current split, or finished splits (to keep knowledge about current split
IDs out of the reader formats).
Modifier and Type | Method and Description |
---|---|
static <T> FileRecords<T> |
finishedSplit(String splitId) |
Set<String> |
finishedSplits()
Get the finished splits.
|
static <T> FileRecords<T> |
forRecords(String splitId,
BulkFormat.RecordIterator<T> recordsForSplit) |
RecordAndPosition<T> |
nextRecordFromSplit()
Gets the next record from the current split.
|
String |
nextSplit()
Moves to the next split.
|
void |
recycle()
This method is called when all records from this batch have been emitted.
|
@Nullable public String nextSplit()
RecordsWithSplitIds
nextSplit
in interface RecordsWithSplitIds<RecordAndPosition<T>>
@Nullable public RecordAndPosition<T> nextRecordFromSplit()
RecordsWithSplitIds
nextRecordFromSplit
in interface RecordsWithSplitIds<RecordAndPosition<T>>
public void recycle()
RecordsWithSplitIds
Overriding this method gives implementations the opportunity to recycle/reuse this object, which is a performance optimization that is important for cases where the record objects are large or otherwise heavy to allocate.
recycle
in interface RecordsWithSplitIds<RecordAndPosition<T>>
public Set<String> finishedSplits()
RecordsWithSplitIds
finishedSplits
in interface RecordsWithSplitIds<RecordAndPosition<T>>
public static <T> FileRecords<T> forRecords(String splitId, BulkFormat.RecordIterator<T> recordsForSplit)
public static <T> FileRecords<T> finishedSplit(String splitId)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.