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
,StringAnyAggregator
,StringColumnDoubleAggregatorWrapper
,StringColumnFloatAggregatorWrapper
,StringColumnLongAggregatorWrapper
,StringFirstAggregator
,StringLastAggregator
,SuppressedAggregatorFactory.SuppressedAggregator
public interface Aggregator extends Closeable
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 ofColumnValueSelector
objects. During ingestion,OnheapIncrementalIndex
uses instances of this class from multiple threads. In particular, ingestion threads callaggregate()
simultaneously with query threads calling the various "get" methods. Instances of this class must be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
aggregate()
Performs aggregation.default long
aggregateWithSize()
Performs aggregation and returns the increase in required on-heap memory caused by this aggregation step.void
close()
Object
get()
default double
getDouble()
The default implementation castsgetFloat()
to double.float
getFloat()
long
getLong()
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.
-
-
-
Method Detail
-
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.
-
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-