public class SUM extends AlgebraicByteArrayMathBase
Algebraic
, so if possible the execution will
performed in a distributed fashion.
SUM can operate on any numeric type. It can also operate on bytearrays, which it will cast to doubles. It expects a bag of tuples of one record each. If Pig knows from the schema that this function will be passed a bag of integers or longs, it will use a specially adapted version of SUM that uses integer arithmetic for summing the data. The return type of SUM is double for float, double, or bytearray arguments and long for int or long arguments.
SUM implements the Accumulator
interface as well.
While this will never be
the preferred method of usage it is available in case the combiner can not be
used for a given calculation.
Modifier and Type | Class and Description |
---|---|
protected static class |
AlgebraicMathBase.KNOWN_OP |
protected static interface |
AlgebraicMathBase.KnownOpProvider |
static class |
SUM.Final |
static class |
SUM.Intermediate |
AlgebraicByteArrayMathBase.Initial
EvalFunc.SchemaType
Modifier and Type | Field and Description |
---|---|
protected AlgebraicMathBase.KnownOpProvider |
opProvider |
log, pigLogger, reporter, returnType
Constructor and Description |
---|
SUM() |
Modifier and Type | Method and Description |
---|---|
java.util.List<FuncSpec> |
getArgToFuncMapping()
Allow a UDF to specify type specific implementations of itself.
|
java.lang.String |
getFinal()
Get the final function.
|
java.lang.String |
getIntermed()
Get the intermediate function.
|
protected void |
setOp(AlgebraicMathBase.KNOWN_OP op) |
accumulate, cleanup, doTupleWork, exec, getInitial, getSeed, getValue, outputSchema
allowCompileTimeCalculation, finish, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
protected AlgebraicMathBase.KnownOpProvider opProvider
public java.util.List<FuncSpec> getArgToFuncMapping() throws FrontendException
EvalFunc
getArgToFuncMapping
in class EvalFunc<java.lang.Double>
FrontendException
protected void setOp(AlgebraicMathBase.KNOWN_OP op)
public java.lang.String getIntermed()
Algebraic
getIntermed
in interface Algebraic
public java.lang.String getFinal()
Algebraic
Copyright © 2007-2012 The Apache Software Foundation