Class AvgAggregator

All Implemented Interfaces:
Externalizable, Serializable, Formatable, TypedFormat, ExecAggregator

public final class AvgAggregator extends SumAggregator
Aggregator for AVG(). Extends the SumAggregator and implements a count. Result is then sum()/count(). To handle overflow we catch the exception for value out of range, then we swap the holder for the current sum to one that can handle a larger range. Eventually a sum may end up in a SQLDecimal which can handle an infinite range. Once this type promotion has happened, it will not revert back to the original type, even if the sum would fit in a lesser type.
See Also: