org.apache.hadoop.mapred
Class LineRecordReader

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

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

Treats keys as offset in file and value as line.


Nested Class Summary
static class LineRecordReader.LineReader
          Deprecated. Use LineReader instead.
 
Constructor Summary
LineRecordReader(org.apache.hadoop.conf.Configuration job, FileSplit split)
           
LineRecordReader(org.apache.hadoop.conf.Configuration job, FileSplit split, byte[] recordDelimiter)
           
LineRecordReader(InputStream in, long offset, long endOffset, org.apache.hadoop.conf.Configuration job)
           
LineRecordReader(InputStream in, long offset, long endOffset, org.apache.hadoop.conf.Configuration job, byte[] recordDelimiter)
           
LineRecordReader(InputStream in, long offset, long endOffset, int maxLineLength)
           
LineRecordReader(InputStream in, long offset, long endOffset, int maxLineLength, byte[] recordDelimiter)
           
 
Method Summary
 void close()
          Close this InputSplit to future operations.
 org.apache.hadoop.io.LongWritable createKey()
          Create an object of the appropriate type to be used as a key.
 org.apache.hadoop.io.Text createValue()
          Create an object of the appropriate type to be used as a value.
 long getPos()
          Returns the current position in the input.
 float getProgress()
          Get the progress within the split
 boolean next(org.apache.hadoop.io.LongWritable key, org.apache.hadoop.io.Text value)
          Read a line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineRecordReader

public LineRecordReader(org.apache.hadoop.conf.Configuration job,
                        FileSplit split)
                 throws IOException
Throws:
IOException

LineRecordReader

public LineRecordReader(org.apache.hadoop.conf.Configuration job,
                        FileSplit split,
                        byte[] recordDelimiter)
                 throws IOException
Throws:
IOException

LineRecordReader

public LineRecordReader(InputStream in,
                        long offset,
                        long endOffset,
                        int maxLineLength)

LineRecordReader

public LineRecordReader(InputStream in,
                        long offset,
                        long endOffset,
                        int maxLineLength,
                        byte[] recordDelimiter)

LineRecordReader

public LineRecordReader(InputStream in,
                        long offset,
                        long endOffset,
                        org.apache.hadoop.conf.Configuration job)
                 throws IOException
Throws:
IOException

LineRecordReader

public LineRecordReader(InputStream in,
                        long offset,
                        long endOffset,
                        org.apache.hadoop.conf.Configuration job,
                        byte[] recordDelimiter)
                 throws IOException
Throws:
IOException
Method Detail

createKey

public org.apache.hadoop.io.LongWritable createKey()
Description copied from interface: RecordReader
Create an object of the appropriate type to be used as a key.

Specified by:
createKey in interface RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
a new key object.

createValue

public org.apache.hadoop.io.Text createValue()
Description copied from interface: RecordReader
Create an object of the appropriate type to be used as a value.

Specified by:
createValue in interface RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
a new value object.

next

public boolean next(org.apache.hadoop.io.LongWritable key,
                    org.apache.hadoop.io.Text value)
             throws IOException
Read a line.

Specified by:
next in interface RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Parameters:
key - the key to read data into
value - the value to read data into
Returns:
true iff a key/value was read, false if at EOF
Throws:
IOException

getProgress

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

Specified by:
getProgress in interface RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
progress from 0.0 to 1.0.
Throws:
IOException

getPos

public long getPos()
            throws IOException
Description copied from interface: RecordReader
Returns the current position in the input.

Specified by:
getPos in interface RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
Returns:
the current position in the input.
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: RecordReader
Close this InputSplit to future operations.

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


Copyright © 2013 Apache Software Foundation. All Rights Reserved.