Interface Aggregator
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
CardinalityAggregator,CountAggregator,DelegatingAggregator,DoubleAnyAggregator,DoubleFirstAggregator,DoubleLastAggregator,DoubleMaxAggregator,DoubleMeanAggregator,DoubleMinAggregator,DoubleSumAggregator,ExpressionLambdaAggregator,FilteredAggregator,FloatAnyAggregator,FloatFirstAggregator,FloatLastAggregator,FloatMaxAggregator,FloatMinAggregator,FloatSumAggregator,HistogramAggregator,HyperUniquesAggregator,JavaScriptAggregator,LongAnyAggregator,LongConstantAggregator,LongFirstAggregator,LongLastAggregator,LongMaxAggregator,LongMinAggregator,LongSumAggregator,NoopAggregator,NullableNumericAggregator,NumericAnyAggregator,NumericFirstAggregator,NumericLastAggregator,ObjectColumnDoubleAggregatorWrapper,ObjectColumnFloatAggregatorWrapper,ObjectColumnLongAggregatorWrapper,SingleValueAggregator,StringAnyAggregator,StringFirstAggregator,StringLastAggregator,SuppressedAggregatorFactory.SuppressedAggregator
An Aggregator is an object that can aggregate metrics. Its aggregation-related methods (namely, aggregate() and get())
do not take any arguments as the assumption is that the Aggregator was given something in its constructor that
it can use to get at the next bit of data.
Thus, an Aggregator can be thought of as a closure over some other thing that is stateful and changes between calls
to aggregate(). This is currently (as of this documentation) implemented through the use of
ColumnValueSelector objects.
During ingestion, OnheapIncrementalIndex uses instances of this class
from multiple threads. In particular, ingestion threads call aggregate() simultaneously with query threads
calling the various "get" methods. Instances of this class must be thread-safe.-
Method Summary
Modifier and TypeMethodDescriptionvoidPerforms aggregation.default longPerforms aggregation and returns the increase in required on-heap memory caused by this aggregation step.voidclose()get()default doubleThe default implementation castsgetFloat()to double.floatgetFloat()longgetLong()default booleanisNull()returns true if aggregator's output type is primitive long/double/float and aggregated value is null, but when aggregated output type is Object, this method always returns false, and users are advised to check nullability for the object returned byget()method.
-
Method Details
-
aggregate
void aggregate()Performs aggregation. -
aggregateWithSize
default long aggregateWithSize()Performs aggregation and returns the increase in required on-heap memory caused by this aggregation step.The default implementation of this method calls
aggregate()and returns 0.If overridden, this method must include the JVM object overheads in the size estimation and must ensure not to underestimate required memory as that might lead to OOM errors.
- Returns:
- Increase in required on-heap memory caused by this aggregation step.
-
get
-
getFloat
float getFloat() -
getLong
long getLong() -
getDouble
default double getDouble()The default implementation castsgetFloat()to double. This default method is added to enable smooth backward compatibility, please re-implement it if your aggregators work with numeric double columns. -
isNull
default boolean isNull()returns true if aggregator's output type is primitive long/double/float and aggregated value is null, but when aggregated output type is Object, this method always returns false, and users are advised to check nullability for the object returned byget()method. The default implementation always return false to enable smooth backward compatibility, re-implement if your aggregator is nullable. -
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-