Generates the average of a set of values. This class implements {@link org.apache.pig.Algebraic}, so if possible the execution will performed in a distributed fashion.
AVG 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 AVG that uses integer arithmetic for summing the data. The return type of AVG will always be double, regardless of the input type.
AVG implements the {@link org.apache.pig.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