org.apache.hadoop.hbase.mapred
Class TableInputFormatBase.TableRecordReader

java.lang.Object
  extended by org.apache.hadoop.hbase.mapred.TableInputFormatBase.TableRecordReader
All Implemented Interfaces:
org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>
Enclosing class:
TableInputFormatBase

protected class TableInputFormatBase.TableRecordReader
extends Object
implements org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>

Iterate over an HBase table data, return (Text, RowResult) pairs


Constructor Summary
protected TableInputFormatBase.TableRecordReader()
           
 
Method Summary
 void close()
          
 ImmutableBytesWritable createKey()
           
 RowResult createValue()
           
 long getPos()
          
 float getProgress()
          
 void init()
          Build the scanner.
 boolean next(ImmutableBytesWritable key, RowResult value)
           
 void restart(byte[] firstRow)
          Restart from survivable exceptions by creating a new scanner.
 void setEndRow(byte[] endRow)
           
 void setHTable(HTable htable)
           
 void setInputColumns(byte[][] inputColumns)
           
 void setRowFilter(RowFilterInterface rowFilter)
           
 void setStartRow(byte[] startRow)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableInputFormatBase.TableRecordReader

protected TableInputFormatBase.TableRecordReader()
Method Detail

restart

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

Throws:
IOException

init

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

Throws:
IOException

setHTable

public void setHTable(HTable htable)
Parameters:
htable - the HTable to scan.

setInputColumns

public void setInputColumns(byte[][] inputColumns)
Parameters:
inputColumns - the columns to be placed in RowResult.

setStartRow

public void setStartRow(byte[] startRow)
Parameters:
startRow - the first row in the split

setEndRow

public void setEndRow(byte[] endRow)
Parameters:
endRow - the last row in the split

setRowFilter

public void setRowFilter(RowFilterInterface rowFilter)
Parameters:
rowFilter - the RowFilterInterface to be used.

close

public void close()
           throws IOException

Specified by:
close in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>
Throws:
IOException

createKey

public ImmutableBytesWritable createKey()
Specified by:
createKey in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>
Returns:
ImmutableBytesWritable
See Also:
RecordReader.createKey()

createValue

public RowResult createValue()
Specified by:
createValue in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>
Returns:
RowResult
See Also:
RecordReader.createValue()

getPos

public long getPos()

Specified by:
getPos in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>

getProgress

public float getProgress()

Specified by:
getProgress in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>

next

public boolean next(ImmutableBytesWritable key,
                    RowResult value)
             throws IOException
Specified by:
next in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult>
Parameters:
key - HStoreKey as input key.
value - MapWritable as input value
Returns:
true if there was more data
Throws:
IOException


Copyright © 2008 The Apache Software Foundation