org.apache.pig.builtin
Class MIN
java.lang.Object
org.apache.pig.EvalFunc<Double>
org.apache.pig.builtin.MIN
- All Implemented Interfaces:
- Accumulator<Double>, Algebraic
public class MIN
- extends EvalFunc<Double>
- implements Algebraic, Accumulator<Double>
Generates the min of the values of the first field of a tuple.
Constructor Summary |
MIN()
|
Methods inherited from class org.apache.pig.EvalFunc |
finish, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, isAsynchronous, progress, setPigLogger, setReporter, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MIN
public MIN()
exec
public Double exec(Tuple input)
throws IOException
- Description copied from class:
EvalFunc
- This callback method must be implemented by all subclasses. This
is the method that will be invoked on every Tuple of a given dataset.
Since the dataset may be divided up in a variety of ways the programmer
should not make assumptions about state that is maintained between
invocations of this method.
- Specified by:
exec
in class EvalFunc<Double>
- Parameters:
input
- the Tuple to be processed.
- Returns:
- result, of type T.
- Throws:
IOException
getInitial
public String getInitial()
- Specified by:
getInitial
in interface Algebraic
- Returns:
- A string to instatiate f_init. f_init should be an eval func
getIntermed
public String getIntermed()
- Specified by:
getIntermed
in interface Algebraic
- Returns:
- A string to instantiate f_intermed. f_intermed should be an eval func
getFinal
public String getFinal()
- Specified by:
getFinal
in interface Algebraic
- Returns:
- A string to instantiate f_final. f_final should be an eval func parametrized by
the same datum as the eval func implementing this interface
min
protected static Double min(Tuple input)
throws ExecException
- Throws:
ExecException
minDoubles
protected static Double minDoubles(Tuple input)
throws ExecException
- Throws:
ExecException
outputSchema
public Schema outputSchema(Schema input)
- Overrides:
outputSchema
in class EvalFunc<Double>
- Parameters:
input
- Schema of the input
- Returns:
- Schema of the output
getArgToFuncMapping
public List<FuncSpec> getArgToFuncMapping()
throws FrontendException
- Overrides:
getArgToFuncMapping
in class EvalFunc<Double>
- Returns:
- A List containing FuncSpec objects representing the Function class
which can handle the inputs corresponding to the schema in the objects
- Throws:
FrontendException
accumulate
public void accumulate(Tuple b)
throws IOException
- Description copied from interface:
Accumulator
- Pass tuples to the UDF. You can retrive DataBag by calling b.get(index).
Each DataBag may contain 0 to many tuples for current key
- Specified by:
accumulate
in interface Accumulator<Double>
- 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<Double>
getValue
public Double getValue()
- Description copied from interface:
Accumulator
- Called when all tuples from current key have been passed to accumulate.
- Specified by:
getValue
in interface Accumulator<Double>
- Returns:
- the value for the UDF for this key.
Copyright © ${year} The Apache Software Foundation