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.


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 init()
          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
 

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.

init

public void init()
          throws IOException
Build the scanner. Not done in constructor to allow for extension.

Throws:
IOException - When restarting the scan 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.

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 © 2011 The Apache Software Foundation. All Rights Reserved.