public class LineRecordReader extends BaseRecordReader
| Modifier and Type | Field and Description |
|---|---|
protected Configuration |
conf |
protected InputSplit |
inputSplit |
protected int |
lineIndex |
protected URI[] |
locations |
protected int |
splitIndex |
listenersAPPEND_LABEL, LABELS, NAME_SPACE| Constructor and Description |
|---|
LineRecordReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
closeIfRequired(Iterator<String> iterator) |
Configuration |
getConf()
Return the configuration used by this object.
|
protected Iterator<String> |
getIterator(int location) |
List<String> |
getLabels()
List of label strings
|
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 RecordReader.loadFromMetaData(List) |
List<Writable> |
next()
Get the next record
|
Record |
nextRecord()
Similar to
RecordReader.next(), but returns a Record object, that may include metadata such as the source
of the data |
protected void |
onLocationOpen(URI location) |
List<Writable> |
record(URI uri,
DataInputStream dataInputStream)
Load the record from the given DataInputStream
Unlike
RecordReader.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 |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
batchesSupported, getListeners, invokeListeners, next, setListeners, setListenersprotected URI[] locations
protected int splitIndex
protected int lineIndex
protected Configuration conf
protected InputSplit inputSplit
public void initialize(InputSplit split) throws IOException, InterruptedException
RecordReadersplit - the split that defines the range of records to readIOExceptionInterruptedExceptionpublic void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException
RecordReaderconf - a configuration for initializationsplit - the split that defines the range of records to readIOExceptionInterruptedExceptionpublic List<Writable> next()
RecordReaderpublic boolean hasNext()
RecordReaderprotected void onLocationOpen(URI location)
public void close()
throws IOException
IOExceptionpublic void setConf(Configuration conf)
Configurablepublic Configuration getConf()
Configurablepublic List<String> getLabels()
RecordReaderpublic void reset()
RecordReaderpublic List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException
RecordReaderRecordReader.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 streampublic Record nextRecord()
RecordReaderRecordReader.next(), but returns a Record object, that may include metadata such as the source
of the datapublic Record loadFromMetaData(RecordMetaData recordMetaData) throws IOException
RecordReaderRecordMetaData instanceRecordReader.loadFromMetaData(List)recordMetaData - Metadata for the record that we want to load fromIOException - If I/O error occurs during loadingpublic List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException
RecordReaderRecordMetaData instancesrecordMetaDatas - Metadata for the records that we want to load fromIOException - If I/O error occurs during loadingCopyright © 2017. All rights reserved.