org.apache.pig.piggybank.storage.avro
Class PigAvroRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.Writable>
      extended by org.apache.pig.piggybank.storage.avro.PigAvroRecordReader
All Implemented Interfaces:
Closeable

public class PigAvroRecordReader
extends org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.Writable>

This is an implementation of record reader which reads in avro data and convert them into pairs.


Constructor Summary
PigAvroRecordReader(org.apache.hadoop.mapreduce.TaskAttemptContext context, org.apache.hadoop.mapreduce.lib.input.FileSplit split, org.apache.avro.Schema readerSchema, boolean ignoreBadFiles, Map<org.apache.hadoop.fs.Path,Map<Integer,Integer>> schemaToMergedSchemaMap, boolean useMultipleSchemas)
          constructor to initialize input and avro data reader
 
Method Summary
 void close()
           
 org.apache.hadoop.io.NullWritable getCurrentKey()
           
 org.apache.hadoop.io.Writable getCurrentValue()
           
 long getPos()
           
 float getProgress()
           
 void initialize(org.apache.hadoop.mapreduce.InputSplit arg0, org.apache.hadoop.mapreduce.TaskAttemptContext arg1)
           
 boolean nextKeyValue()
           
protected  Tuple wrapAsTuple(Object in)
          Wrap non-tuple value as a tuple
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PigAvroRecordReader

public PigAvroRecordReader(org.apache.hadoop.mapreduce.TaskAttemptContext context,
                           org.apache.hadoop.mapreduce.lib.input.FileSplit split,
                           org.apache.avro.Schema readerSchema,
                           boolean ignoreBadFiles,
                           Map<org.apache.hadoop.fs.Path,Map<Integer,Integer>> schemaToMergedSchemaMap,
                           boolean useMultipleSchemas)
                    throws IOException
constructor to initialize input and avro data reader

Throws:
IOException
Method Detail

getProgress

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

getPos

public long getPos()
            throws IOException
Throws:
IOException

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.NullWritable,org.apache.hadoop.io.Writable>
Throws:
IOException

getCurrentKey

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

getCurrentValue

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

wrapAsTuple

protected Tuple wrapAsTuple(Object in)
Wrap non-tuple value as a tuple


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.NullWritable,org.apache.hadoop.io.Writable>
Throws:
IOException
InterruptedException

nextKeyValue

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


Copyright © 2007-2012 The Apache Software Foundation