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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the split.Returns the current key.Returns the current value.float
The current progress of the record reader through its data.void
initialize
(org.apache.hadoop.mapreduce.InputSplit inputsplit, org.apache.hadoop.mapreduce.TaskAttemptContext context) Initializes the reader.boolean
Positions the record reader to the next record.void
restart
(byte[] firstRow) Restart from survivable exceptions by creating a new scanner.void
Sets 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
- theTable
to scan.
-
setScan
Sets the scan defining the actual details like columns etc.- Parameters:
scan
- The scan to set.
-
close
Closes the split.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,
Result> - See Also:
-
RecordReader.close()
-
getCurrentKey
Returns the current key.- Specified by:
getCurrentKey
in 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:
getCurrentValue
in 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:
initialize
in 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:
nextKeyValue
in classorg.apache.hadoop.mapreduce.RecordReader<ImmutableBytesWritable,
Result> - Returns:
true
if 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:
getProgress
in 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()
-