org.apache.pig.builtin
Class LongMax

java.lang.Object
  extended by org.apache.pig.EvalFunc<Long>
      extended by org.apache.pig.builtin.LongMax
All Implemented Interfaces:
Accumulator<Long>, Algebraic

public class LongMax
extends EvalFunc<Long>
implements Algebraic, Accumulator<Long>

This method should never be used directly, use MAX.


Nested Class Summary
static class LongMax.Final
           
static class LongMax.Initial
           
static class LongMax.Intermediate
           
 
Field Summary
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
LongMax()
           
 
Method Summary
 void accumulate(Tuple b)
          Pass tuples to the UDF.
 void cleanup()
          Called after getValue() to prepare processing for next key.
 Long exec(Tuple input)
          This callback method must be implemented by all subclasses.
 String getFinal()
          Get the final function.
 String getInitial()
          Get the initial function.
 String getIntermed()
          Get the intermediate function.
 Long getValue()
          Called when all tuples from current key have been passed to accumulate.
protected static Long max(Tuple input)
           
 Schema outputSchema(Schema input)
          Report the schema of the output of this UDF.
 
Methods inherited from class org.apache.pig.EvalFunc
finish, getArgToFuncMapping, getCacheFiles, 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
 

Constructor Detail

LongMax

public LongMax()
Method Detail

exec

public Long 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<Long>
Parameters:
input - the Tuple to be processed.
Returns:
result, of type T.
Throws:
IOException

getInitial

public String getInitial()
Description copied from interface: Algebraic
Get the initial function.

Specified by:
getInitial in interface Algebraic
Returns:
A function name of f_init. f_init should be an eval func.

getIntermed

public String getIntermed()
Description copied from interface: Algebraic
Get the intermediate function.

Specified by:
getIntermed in interface Algebraic
Returns:
A function name of f_intermed. f_intermed should be an eval func.

getFinal

public String getFinal()
Description copied from interface: Algebraic
Get the final function.

Specified by:
getFinal in interface Algebraic
Returns:
A function name of f_final. f_final should be an eval func parametrized by the same datum as the eval func implementing this interface.

max

protected static Long max(Tuple input)
                   throws ExecException
Throws:
ExecException

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.

Overrides:
outputSchema in class EvalFunc<Long>
Parameters:
input - Schema of the input
Returns:
Schema of the output

accumulate

public void accumulate(Tuple b)
                throws IOException
Description copied from interface: Accumulator
Pass tuples to the UDF.

Specified by:
accumulate in interface Accumulator<Long>
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<Long>

getValue

public Long getValue()
Description copied from interface: Accumulator
Called when all tuples from current key have been passed to accumulate.

Specified by:
getValue in interface Accumulator<Long>
Returns:
the value for the UDF for this key.


Copyright © ${year} The Apache Software Foundation