org.apache.pig.backend.hadoop.executionengine.mapReduceLayer
Class PigMapBase

java.lang.Object
  extended by org.apache.hadoop.mapred.MapReduceBase
      extended by org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase
All Implemented Interfaces:
Closeable, org.apache.hadoop.mapred.JobConfigurable
Direct Known Subclasses:
PigMapOnly.Map, PigMapReduce.Map, PigMapReduce.MapWithComparator

public abstract class PigMapBase
extends org.apache.hadoop.mapred.MapReduceBase


Field Summary
protected  boolean errorInMap
           
protected  byte keyType
           
protected  PhysicalPlan mp
           
protected  TupleFactory tf
           
 
Constructor Summary
PigMapBase()
           
 
Method Summary
 void close()
          Will be called when all the tuples in the input are done.
abstract  void collect(org.apache.hadoop.mapred.OutputCollector<PigNullableWritable,org.apache.hadoop.io.Writable> oc, Tuple tuple)
           
 void configure(org.apache.hadoop.mapred.JobConf job)
          Configures the mapper with the map plan and the reproter thread
 byte getKeyType()
           
 void map(org.apache.hadoop.io.Text key, Tuple inpTuple, org.apache.hadoop.mapred.OutputCollector<PigNullableWritable,org.apache.hadoop.io.Writable> oc, org.apache.hadoop.mapred.Reporter reporter)
          The map function that attaches the inpTuple appropriately and executes the map plan if its not empty.
 void setKeyType(byte keyType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyType

protected byte keyType

mp

protected PhysicalPlan mp

tf

protected TupleFactory tf

errorInMap

protected boolean errorInMap
Constructor Detail

PigMapBase

public PigMapBase()
Method Detail

close

public void close()
           throws IOException
Will be called when all the tuples in the input are done. So reporter thread should be closed.

Specified by:
close in interface Closeable
Overrides:
close in class org.apache.hadoop.mapred.MapReduceBase
Throws:
IOException

configure

public void configure(org.apache.hadoop.mapred.JobConf job)
Configures the mapper with the map plan and the reproter thread

Specified by:
configure in interface org.apache.hadoop.mapred.JobConfigurable
Overrides:
configure in class org.apache.hadoop.mapred.MapReduceBase

map

public void map(org.apache.hadoop.io.Text key,
                Tuple inpTuple,
                org.apache.hadoop.mapred.OutputCollector<PigNullableWritable,org.apache.hadoop.io.Writable> oc,
                org.apache.hadoop.mapred.Reporter reporter)
         throws IOException
The map function that attaches the inpTuple appropriately and executes the map plan if its not empty. Collects the result of execution into oc or the input directly to oc if map plan empty. The collection is left abstract for the map-only or map-reduce job to implement. Map-only collects the tuple as-is whereas map-reduce collects it after extracting the key and indexed tuple.

Throws:
IOException

collect

public abstract void collect(org.apache.hadoop.mapred.OutputCollector<PigNullableWritable,org.apache.hadoop.io.Writable> oc,
                             Tuple tuple)
                      throws ExecException,
                             IOException
Throws:
ExecException
IOException

getKeyType

public byte getKeyType()
Returns:
the keyType

setKeyType

public void setKeyType(byte keyType)
Parameters:
keyType - the keyType to set


Copyright © ${year} The Apache Software Foundation