public class BigIntegerAvg extends EvalFunc<BigDecimal> implements Algebraic, Accumulator<BigDecimal>
AVG.| Modifier and Type | Class and Description |
|---|---|
static class |
BigIntegerAvg.Final |
static class |
BigIntegerAvg.Initial |
static class |
BigIntegerAvg.Intermediate |
EvalFunc.SchemaTypelog, pigLogger, reporter, returnType| Constructor and Description |
|---|
BigIntegerAvg() |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulate(Tuple b)
Pass tuples to the UDF.
|
void |
cleanup()
Called after getValue() to prepare processing for next key.
|
protected static Tuple |
combine(DataBag values) |
protected static BigInteger |
count(Tuple input) |
protected static BigDecimal |
div(BigInteger dividend,
BigInteger divisor) |
BigDecimal |
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.
|
BigDecimal |
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.
|
protected static BigInteger |
sum(Tuple input) |
allowCompileTimeCalculation, finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLoadCaster, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warnpublic BigDecimal exec(Tuple input) throws IOException
EvalFuncexec in class EvalFunc<BigDecimal>input - the Tuple to be processed.IOExceptionpublic String getInitial()
AlgebraicgetInitial in interface Algebraicpublic String getIntermed()
AlgebraicgetIntermed in interface Algebraicpublic String getFinal()
Algebraicprotected static Tuple combine(DataBag values) throws ExecException
ExecExceptionprotected static BigInteger count(Tuple input) throws ExecException
ExecExceptionprotected static BigInteger sum(Tuple input) throws ExecException, IOException
ExecExceptionIOExceptionprotected static BigDecimal div(BigInteger dividend, BigInteger divisor)
public Schema outputSchema(Schema input)
EvalFunc
The default implementation interprets the OutputSchema annotation,
if one is present. Otherwise, it returns null (no known output schema).
outputSchema in class EvalFunc<BigDecimal>input - Schema of the inputpublic void accumulate(Tuple b) throws IOException
Accumulatoraccumulate in interface Accumulator<BigDecimal>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.IOExceptionpublic void cleanup()
Accumulatorcleanup in interface Accumulator<BigDecimal>public BigDecimal getValue()
AccumulatorgetValue in interface Accumulator<BigDecimal>Copyright © 2007-2017 The Apache Software Foundation