org.apache.pig.scripting.groovy
Class GroovyAccumulatorEvalFunc
java.lang.Object
org.apache.pig.EvalFunc<T>
org.apache.pig.AccumulatorEvalFunc<Object>
org.apache.pig.scripting.groovy.GroovyAccumulatorEvalFunc
- All Implemented Interfaces:
- Accumulator<Object>
public class GroovyAccumulatorEvalFunc
- extends AccumulatorEvalFunc<Object>
Method Summary |
void |
accumulate(Tuple b)
Pass tuples to the UDF. |
void |
cleanup()
Called after getValue() to prepare processing for next key. |
Object |
getValue()
Called when all tuples from current key have been passed to accumulate. |
Schema |
outputSchema(Schema input)
Report the schema of the output of this UDF. |
Methods inherited from class org.apache.pig.EvalFunc |
finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, isAsynchronous, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GroovyAccumulatorEvalFunc
public GroovyAccumulatorEvalFunc(String path,
String namespace,
String accumulatorMethod,
String accumulateMethod,
String getValueMethod,
String cleanupMethod)
throws IOException
- Throws:
IOException
accumulate
public void accumulate(Tuple b)
throws IOException
- Description copied from interface:
Accumulator
- Pass tuples to the UDF.
- Specified by:
accumulate
in interface Accumulator<Object>
- Specified by:
accumulate
in class AccumulatorEvalFunc<Object>
- Parameters:
b
- A tuple containing a single field, which is a bag. The bag will contain the set
of tuples being passed to the UDF in this iteration.
- Throws:
IOException
cleanup
public void cleanup()
- Description copied from interface:
Accumulator
- Called after getValue() to prepare processing for next key.
- Specified by:
cleanup
in interface Accumulator<Object>
- Specified by:
cleanup
in class AccumulatorEvalFunc<Object>
getValue
public Object getValue()
- Description copied from interface:
Accumulator
- Called when all tuples from current key have been passed to accumulate.
- Specified by:
getValue
in interface Accumulator<Object>
- Specified by:
getValue
in class AccumulatorEvalFunc<Object>
- Returns:
- the value for the UDF for this key.
outputSchema
public Schema outputSchema(Schema input)
- Description copied from class:
EvalFunc
- Report the schema of the output of this UDF. Pig will make use of
this in error checking, optimization, and planning. The schema
of input data to this UDF is provided.
The default implementation interprets the OutputSchema
annotation,
if one is present. Otherwise, it returns null
(no known output schema).
- Overrides:
outputSchema
in class EvalFunc<Object>
- Parameters:
input
- Schema of the input
- Returns:
- Schema of the output
Copyright © 2007-2012 The Apache Software Foundation