org.apache.hadoop.hbase.mapred
Class TableRecordReader

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

public class TableRecordReader
extends Object
implements org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,Result>

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


Constructor Summary
TableRecordReader()
           
 
Method Summary
 void close()
           
 ImmutableBytesWritable createKey()
           
 Result createValue()
           
 long getPos()
           
 float getProgress()
           
 void init()
          Build the scanner.
 boolean next(ImmutableBytesWritable key, Result 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(Filter 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

TableRecordReader

public TableRecordReader()
Method Detail

restart

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

Parameters:
firstRow -
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 Result.

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(Filter rowFilter)
Parameters:
rowFilter - the Filter to be used.

close

public void close()
Specified by:
close in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,Result>

createKey

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

createValue

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

getPos

public long getPos()
Specified by:
getPos in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,Result>

getProgress

public float getProgress()
Specified by:
getProgress in interface org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,Result>

next

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


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