Class NumericSummaryAggregator<T extends Number>
- java.lang.Object
-
- org.apache.flink.api.java.summarize.aggregation.NumericSummaryAggregator<T>
-
- Type Parameters:
T- numeric type to aggregrate and create a summary, e.g. Integer, DoubleValue
- All Implemented Interfaces:
Serializable,Aggregator<T,NumericColumnSummary<T>>
- Direct Known Subclasses:
DoubleSummaryAggregator,FloatSummaryAggregator,IntegerSummaryAggregator,LongSummaryAggregator,ShortSummaryAggregator
@Internal public abstract class NumericSummaryAggregator<T extends Number> extends Object implements Aggregator<T,NumericColumnSummary<T>>
Generic aggregator for all numeric types creates a summary of a column of numbers.Uses the Kahan summation algorithm to avoid numeric instability when computing variance. The algorithm is described in: "Scalable and Numerically Stable Descriptive Statistics in SystemML", Tian et al, International Conference on Data Engineering 2012
Implementation that couldn't be generic for all numbers was pushed to subclasses. For example, there isn't a generic way to calculate min, max, sum, isNan, isInfinite for all numeric types so subclasses must implement these.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumericSummaryAggregator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaggregate(T value)Add a value to the current aggregation.voidcombine(Aggregator<T,NumericColumnSummary<T>> otherSameType)combine two aggregations.protected abstract Aggregator<T,T>initMax()protected abstract Aggregator<T,T>initMin()protected abstract Aggregator<T,T>initSum()protected abstract booleanisInfinite(T number)protected abstract booleanisNan(T number)NumericColumnSummary<T>result()Provide the final result of the aggregation.
-
-
-
Method Detail
-
aggregate
public void aggregate(T value)
Add a value to the current aggregation.- Specified by:
aggregatein interfaceAggregator<T extends Number,NumericColumnSummary<T extends Number>>
-
combine
public void combine(Aggregator<T,NumericColumnSummary<T>> otherSameType)
combine two aggregations.- Specified by:
combinein interfaceAggregator<T extends Number,NumericColumnSummary<T extends Number>>
-
result
public NumericColumnSummary<T> result()
Description copied from interface:AggregatorProvide the final result of the aggregation.- Specified by:
resultin interfaceAggregator<T extends Number,NumericColumnSummary<T extends Number>>
-
initMin
protected abstract Aggregator<T,T> initMin()
-
initMax
protected abstract Aggregator<T,T> initMax()
-
initSum
protected abstract Aggregator<T,T> initSum()
-
isNan
protected abstract boolean isNan(T number)
-
isInfinite
protected abstract boolean isInfinite(T number)
-
-