org.apache.pig.backend.hadoop.executionengine.mapReduceLayer
Class PigGenericMapReduce.ReduceWithComparator
java.lang.Object
PigMapReduce.Reduce
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce.ReduceWithComparator
- Enclosing class:
- PigGenericMapReduce
public static class PigGenericMapReduce.ReduceWithComparator
- extends PigMapReduce.Reduce
This "specialized" reduce class is ONLY to be used in pig queries with
order by a udf. A UDF used for comparison in the order by expects
to be handed tuples. Hence a specialized map class (PigMapReduce.MapWithComparator)
ensures that the "key" used in the order by is wrapped into a tuple (if it
isn't already a tuple). This reduce class unwraps this tuple in the case where
the map had wrapped into a tuple and handes the "unwrapped" key to the POPackage
for processing
Method Summary |
protected void |
reduce(PigNullableWritable key,
Iterable<NullableTuple> tupIter,
Context context)
The reduce function which packages the key and List<Tuple>
into key, Bag<Tuple> after converting Hadoop type key into Pig type. |
protected void |
setup(Context context)
Configures the Reduce plan, the POPackage operator
and the reporter thread |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PigGenericMapReduce.ReduceWithComparator
public PigGenericMapReduce.ReduceWithComparator()
setup
protected void setup(Context context)
throws IOException,
InterruptedException
- Configures the Reduce plan, the POPackage operator
and the reporter thread
- Throws:
IOException
InterruptedException
reduce
protected void reduce(PigNullableWritable key,
Iterable<NullableTuple> tupIter,
Context context)
throws IOException,
InterruptedException
- The reduce function which packages the key and List<Tuple>
into key, Bag<Tuple> after converting Hadoop type key into Pig type.
The package result is either collected as is, if the reduce plan is
empty or after passing through the reduce plan.
- Throws:
IOException
InterruptedException
Copyright © ${year} The Apache Software Foundation