Sum
class, a subclass of AbstractScoreSlot
, is a score slot type that is meant to contain the "Intermediate sum" or the "Total sum" of the players points. The mode of the slot is decided by variable slotMode
. Slots of this type cannot be manipulated by the player directly.
@author Priidu Neemre
If there are no values in the dataset, or any of the values are NaN
, then NaN
is returned.
Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment()
or clear()
method, it must be synchronized externally.
If there are no values in the dataset, then 0 is returned. If any of the values are NaN
, then NaN
is returned.
Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment()
or clear()
method, it must be synchronized externally.
If there are no values in the dataset, or any of the values are NaN
, then NaN
is returned.
Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment()
or clear()
method, it must be synchronized externally.
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 {@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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|