org.apache.hadoop.hbase.mapreduce
Class TableRecordReaderImpl

java.lang.Object
  extended by org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl

public class TableRecordReaderImpl
extends Object

Iterate over an HBase table data, return (ImmutableBytesWritable, Result) pairs.


Field Summary
static String LOG_PER_ROW_COUNT
           
 
Constructor Summary
TableRecordReaderImpl()
           
 
Method Summary
 void close()
          Closes the split.
 ImmutableBytesWritable getCurrentKey()
          Returns the current key.
 Result getCurrentValue()
          Returns the current value.
 float getProgress()
          The current progress of the record reader through its data.
 void initialize(org.apache.hadoop.mapreduce.InputSplit inputsplit, org.apache.hadoop.mapreduce.TaskAttemptContext context)
          Build the scanner.
 boolean nextKeyValue()
          Positions the record reader to the next record.
 void restart(byte[] firstRow)
          Restart from survivable exceptions by creating a new scanner.
 void setHTable(HTable htable)
          Sets the HBase table.
 void setScan(Scan scan)
          Sets the scan defining the actual details like columns etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_PER_ROW_COUNT

public static final String LOG_PER_ROW_COUNT
See Also:
Constant Field Values
Constructor Detail

TableRecordReaderImpl

public TableRecordReaderImpl()
Method Detail

restart

public void restart(byte[] firstRow)
             throws IOException
Restart from survivable exceptions by creating a new scanner.

Parameters:
firstRow - The first row to start at.
Throws:
IOException - When restarting fails.

setHTable

public void setHTable(HTable htable)
Sets the HBase table.

Parameters:
htable - The HTable to scan.

setScan

public void setScan(Scan scan)
Sets the scan defining the actual details like columns etc.

Parameters:
scan - The scan to set.

initialize

public void initialize(org.apache.hadoop.mapreduce.InputSplit inputsplit,
                       org.apache.hadoop.mapreduce.TaskAttemptContext context)
                throws IOException,
                       InterruptedException
Build the scanner. Not done in constructor to allow for extension.

Throws:
IOException, - InterruptedException
IOException
InterruptedException

close

public void close()
Closes the split.


getCurrentKey

public ImmutableBytesWritable getCurrentKey()
                                     throws IOException,
                                            InterruptedException
Returns the current key.

Returns:
The current key.
Throws:
IOException
InterruptedException - When the job is aborted.

getCurrentValue

public Result getCurrentValue()
                       throws IOException,
                              InterruptedException
Returns the current value.

Returns:
The current value.
Throws:
IOException - When the value is faulty.
InterruptedException - When the job is aborted.

nextKeyValue

public boolean nextKeyValue()
                     throws IOException,
                            InterruptedException
Positions the record reader to the next record.

Returns:
true if there was another record.
Throws:
IOException - When reading the record failed.
InterruptedException - When the job was aborted.

getProgress

public float getProgress()
The current progress of the record reader through its data.

Returns:
A number between 0.0 and 1.0, the fraction of the data read.


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.