Class TableRecordReader
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result>
org.apache.hadoop.hbase.mapreduce.TableRecordReader
- All Implemented Interfaces:
Closeable,AutoCloseable
@Public
public class TableRecordReader
extends org.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result>
Iterate over an HBase table data, return (ImmutableBytesWritable, Result) pairs.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the split.Returns the current key.Returns the current value.floatThe current progress of the record reader through its data.voidinitialize(org.apache.hadoop.mapreduce.InputSplit inputsplit, org.apache.hadoop.mapreduce.TaskAttemptContext context) Initializes the reader.booleanPositions the record reader to the next record.voidrestart(byte[] firstRow) Restart from survivable exceptions by creating a new scanner.voidSets the scan defining the actual details like columns etc.void
-
Field Details
-
recordReaderImpl
-
-
Constructor Details
-
TableRecordReader
public TableRecordReader()
-
-
Method Details
-
restart
Restart from survivable exceptions by creating a new scanner.- Parameters:
firstRow- The first row to start at.- Throws:
IOException- When restarting fails.
-
setTable
- Parameters:
table- theTableto scan.
-
setScan
Sets the scan defining the actual details like columns etc.- Parameters:
scan- The scan to set.
-
close
Closes the split.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - See Also:
-
RecordReader.close()
-
getCurrentKey
Returns the current key.- Specified by:
getCurrentKeyin classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - Returns:
- The current key.
- Throws:
InterruptedException- When the job is aborted.IOException- See Also:
-
RecordReader.getCurrentKey()
-
getCurrentValue
Returns the current value.- Specified by:
getCurrentValuein classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - Returns:
- The current value.
- Throws:
IOException- When the value is faulty.InterruptedException- When the job is aborted.- See Also:
-
RecordReader.getCurrentValue()
-
initialize
public void initialize(org.apache.hadoop.mapreduce.InputSplit inputsplit, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws IOException, InterruptedException Initializes the reader.- Specified by:
initializein classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - Parameters:
inputsplit- The split to work with.context- The current task context.- Throws:
IOException- When setting up the reader fails.InterruptedException- When the job is aborted.- See Also:
-
RecordReader.initialize(org.apache.hadoop.mapreduce.InputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext)
-
nextKeyValue
Positions the record reader to the next record.- Specified by:
nextKeyValuein classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - Returns:
trueif there was another record.- Throws:
IOException- When reading the record failed.InterruptedException- When the job was aborted.- See Also:
-
RecordReader.nextKeyValue()
-
getProgress
The current progress of the record reader through its data.- Specified by:
getProgressin classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,Result> - Returns:
- A number between 0.0 and 1.0, the fraction of the data read.
- See Also:
-
RecordReader.getProgress()
-