org.apache.hadoop.zebra.mapreduce
Class TableRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
      extended by org.apache.hadoop.zebra.mapreduce.TableRecordReader
All Implemented Interfaces:
Closeable

public class TableRecordReader
extends org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>

Adaptor class to implement RecordReader on top of Scanner.


Constructor Summary
TableRecordReader(org.apache.hadoop.zebra.mapreduce.TableExpr expr, String projection, org.apache.hadoop.mapreduce.InputSplit split, org.apache.hadoop.mapreduce.JobContext jobContext)
           
 
Method Summary
 boolean atEnd()
          Check if the end of the input has been reached
 void close()
           
 org.apache.hadoop.io.BytesWritable getCurrentKey()
           
 Tuple getCurrentValue()
           
 long getPos()
           
 float getProgress()
           
 void initialize(org.apache.hadoop.mapreduce.InputSplit arg0, org.apache.hadoop.mapreduce.TaskAttemptContext arg1)
           
 boolean nextKeyValue()
           
 boolean seekTo(org.apache.hadoop.io.BytesWritable key)
          Seek to the position at the first row which has the key or just after the key; only applicable for sorted Zebra table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableRecordReader

public TableRecordReader(org.apache.hadoop.zebra.mapreduce.TableExpr expr,
                         String projection,
                         org.apache.hadoop.mapreduce.InputSplit split,
                         org.apache.hadoop.mapreduce.JobContext jobContext)
                  throws IOException,
                         ParseException
Parameters:
expr - Table expression
projection - projection schema. Should never be null.
split - the split to work on
jobContext - JobContext object
Throws:
IOException
ParseException
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException

getPos

public long getPos()
            throws IOException
Throws:
IOException

getProgress

public float getProgress()
                  throws IOException
Specified by:
getProgress in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException

seekTo

public boolean seekTo(org.apache.hadoop.io.BytesWritable key)
               throws IOException
Seek to the position at the first row which has the key or just after the key; only applicable for sorted Zebra table

Parameters:
key - the key to seek on
Throws:
IOException

atEnd

public boolean atEnd()
              throws IOException
Check if the end of the input has been reached

Returns:
true if the end of the input is reached
Throws:
IOException

getCurrentKey

public org.apache.hadoop.io.BytesWritable getCurrentKey()
                                                 throws IOException,
                                                        InterruptedException
Specified by:
getCurrentKey in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException
InterruptedException

getCurrentValue

public Tuple getCurrentValue()
                      throws IOException,
                             InterruptedException
Specified by:
getCurrentValue in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException
InterruptedException

initialize

public void initialize(org.apache.hadoop.mapreduce.InputSplit arg0,
                       org.apache.hadoop.mapreduce.TaskAttemptContext arg1)
                throws IOException,
                       InterruptedException
Specified by:
initialize in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException
InterruptedException

nextKeyValue

public boolean nextKeyValue()
                     throws IOException,
                            InterruptedException
Specified by:
nextKeyValue in class org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.BytesWritable,Tuple>
Throws:
IOException
InterruptedException


Copyright © ${year} The Apache Software Foundation