public interface RecordReader extends Closeable, Serializable, Configurable
| Modifier and Type | Field and Description |
|---|---|
static String |
APPEND_LABEL |
static String |
LABELS |
static String |
NAME_SPACE |
| Modifier and Type | Method and Description |
|---|---|
boolean |
batchesSupported()
This method returns true, if next(int) signature is supported by this RecordReader implementation.
|
List<String> |
getLabels()
List of label strings
|
List<RecordListener> |
getListeners()
Get the record listeners for this record reader.
|
boolean |
hasNext()
Whether there are anymore records
|
void |
initialize(Configuration conf,
InputSplit split)
Called once at initialization.
|
void |
initialize(InputSplit split)
Called once at initialization.
|
List<Record> |
loadFromMetaData(List<RecordMetaData> recordMetaDatas)
Load multiple records from the given a list of
RecordMetaData instances |
Record |
loadFromMetaData(RecordMetaData recordMetaData)
Load a single record from the given
RecordMetaData instanceNote: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to load multiple records at once using loadFromMetaData(List) |
List<Writable> |
next()
Get the next record
|
List<Writable> |
next(int num)
This method will be used, if batchesSupported() returns true.
|
Record |
nextRecord()
|
List<Writable> |
record(URI uri,
DataInputStream dataInputStream)
Load the record from the given DataInputStream
Unlike
next() the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStream |
void |
reset()
Reset record reader iterator
|
void |
setListeners(Collection<RecordListener> listeners)
Set the record listeners for this record reader.
|
void |
setListeners(RecordListener... listeners)
Set the record listeners for this record reader.
|
getConf, setConfstatic final String NAME_SPACE
static final String APPEND_LABEL
static final String LABELS
void initialize(InputSplit split) throws IOException, InterruptedException
split - the split that defines the range of records to readIOExceptionInterruptedExceptionvoid initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException
conf - a configuration for initializationsplit - the split that defines the range of records to readIOExceptionInterruptedExceptionboolean batchesSupported()
List<Writable> next(int num)
num - boolean hasNext()
void reset()
List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException
next() the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStreamIOException - if error occurs during reading from the input streamRecord nextRecord()
next(), but returns a Record object, that may include metadata such as the source
of the dataRecord loadFromMetaData(RecordMetaData recordMetaData) throws IOException
RecordMetaData instanceloadFromMetaData(List)recordMetaData - Metadata for the record that we want to load fromIOException - If I/O error occurs during loadingList<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException
RecordMetaData instancesrecordMetaDatas - Metadata for the records that we want to load fromIOException - If I/O error occurs during loadingList<RecordListener> getListeners()
void setListeners(RecordListener... listeners)
void setListeners(Collection<RecordListener> listeners)
Copyright © 2017. All rights reserved.