org.apache.hadoop.mapreduce.lib.input
Class LineRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
      extended by org.apache.hadoop.mapreduce.lib.input.LineRecordReader
All Implemented Interfaces:
Closeable

@InterfaceAudience.LimitedPrivate(value={"MapReduce","Pig"})
@InterfaceStability.Evolving
public class LineRecordReader
extends RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>

Treats keys as offset in file and value as line.


Field Summary
static String MAX_LINE_LENGTH
           
 
Constructor Summary
LineRecordReader()
           
LineRecordReader(byte[] recordDelimiter)
           
 
Method Summary
 void close()
          Close the record reader.
 org.apache.hadoop.io.LongWritable getCurrentKey()
          Get the current key
 org.apache.hadoop.io.Text getCurrentValue()
          Get the current value.
 float getProgress()
          Get the progress within the split
 void initialize(InputSplit genericSplit, TaskAttemptContext context)
          Called once at initialization.
 boolean nextKeyValue()
          Read the next key, value pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LINE_LENGTH

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

LineRecordReader

public LineRecordReader()

LineRecordReader

public LineRecordReader(byte[] recordDelimiter)
Method Detail

initialize

public void initialize(InputSplit genericSplit,
                       TaskAttemptContext context)
                throws IOException
Description copied from class: RecordReader
Called once at initialization.

Specified by:
initialize in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Parameters:
genericSplit - the split that defines the range of records to read
context - the information about the task
Throws:
IOException

nextKeyValue

public boolean nextKeyValue()
                     throws IOException
Description copied from class: RecordReader
Read the next key, value pair.

Specified by:
nextKeyValue in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
true if a key/value pair was read
Throws:
IOException

getCurrentKey

public org.apache.hadoop.io.LongWritable getCurrentKey()
Description copied from class: RecordReader
Get the current key

Specified by:
getCurrentKey in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
the current key or null if there is no current key

getCurrentValue

public org.apache.hadoop.io.Text getCurrentValue()
Description copied from class: RecordReader
Get the current value.

Specified by:
getCurrentValue in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
the object that was read

getProgress

public float getProgress()
                  throws IOException
Get the progress within the split

Specified by:
getProgress in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
a number between 0.0 and 1.0 that is the fraction of the data read
Throws:
IOException

close

public void close()
           throws IOException
Description copied from class: RecordReader
Close the record reader.

Specified by:
close in interface Closeable
Specified by:
close in class RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Throws:
IOException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.