public abstract class SimpleDoubleAggregatorFactory extends NullableNumericAggregatorFactory<ColumnValueSelector>
AggregatorFactory
implementations that consume double input
and produce double output on aggregation.
It extends "NullableAggregatorFactoryModifier and Type | Field and Description |
---|---|
protected String |
expression |
protected com.google.common.base.Supplier<Expr> |
fieldExpression |
protected String |
fieldName |
protected ExprMacroTable |
macroTable |
protected String |
name |
protected boolean |
storeDoubleAsFloat |
Constructor and Description |
---|
SimpleDoubleAggregatorFactory(ExprMacroTable macroTable,
String name,
String fieldName,
String expression) |
Modifier and Type | Method and Description |
---|---|
protected abstract Aggregator |
buildAggregator(BaseDoubleColumnValueSelector selector) |
protected abstract BufferAggregator |
buildBufferAggregator(BaseDoubleColumnValueSelector selector) |
boolean |
canVectorize(ColumnInspector columnInspector)
Returns whether or not this aggregation class supports vectorization.
|
Object |
deserialize(Object object)
A method that knows how to "deserialize" the object from whatever form it might have been put into
in order to transfer via JSON.
|
boolean |
equals(Object o) |
protected Aggregator |
factorize(ColumnSelectorFactory metricFactory,
ColumnValueSelector selector)
Creates an
Aggregator to aggregate values from several rows, by using the provided selector. |
protected BufferAggregator |
factorizeBuffered(ColumnSelectorFactory metricFactory,
ColumnValueSelector selector)
Creates an
BufferAggregator to aggregate values from several rows into a ByteBuffer. |
Object |
finalizeComputation(Object object)
"Finalizes" the computation of an object.
|
Comparator |
getComparator() |
String |
getExpression() |
String |
getFieldName() |
ColumnType |
getIntermediateType()
Get the "intermediate"
ColumnType for this aggregator. |
int |
getMaxIntermediateSize()
Returns the maximum size that this aggregator will require in bytes for intermediate storage of results.
|
AggregatorFactory |
getMergingFactory(AggregatorFactory other)
Returns an AggregatorFactory that can be used to combine the output of aggregators from this factory and
another factory.
|
String |
getName() |
int |
hashCode() |
protected abstract double |
nullValue() |
List<String> |
requiredFields()
Get a list of fields that aggregators built by this factory will need to read.
|
protected ColumnValueSelector |
selector(ColumnSelectorFactory metricFactory)
Creates a
ColumnValueSelector for the aggregated column. |
protected VectorValueSelector |
vectorSelector(VectorColumnSelectorFactory columnSelectorFactory)
Creates a
VectorValueSelector for the aggregated column. |
factorize, factorizeBuffered, factorizeVector, factorizeVector, getMaxIntermediateSizeWithNulls, getResultType, makeNullableAggregateCombiner
combine, factorizeWithSize, getCombiningFactory, getComplexTypeName, getFinalizedType, getRequiredColumns, getType, guessAggregatorHeapFootprint, makeAggregateCombiner, mergeAggregators, optimizeForSegment, withName
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getCacheKey
protected final String name
protected final ExprMacroTable macroTable
protected final boolean storeDoubleAsFloat
protected final com.google.common.base.Supplier<Expr> fieldExpression
protected Aggregator factorize(ColumnSelectorFactory metricFactory, ColumnValueSelector selector)
NullableNumericAggregatorFactory
Aggregator
to aggregate values from several rows, by using the provided selector.factorize
in class NullableNumericAggregatorFactory<ColumnValueSelector>
metricFactory
- metricFactoryselector
- ColumnValueSelector
for the column to aggregate.Aggregator
protected BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory, ColumnValueSelector selector)
NullableNumericAggregatorFactory
BufferAggregator
to aggregate values from several rows into a ByteBuffer.factorizeBuffered
in class NullableNumericAggregatorFactory<ColumnValueSelector>
metricFactory
- columnSelectorFactory in case any other columns are needed.selector
- ColumnValueSelector
for the column to aggregate.BufferAggregator
protected ColumnValueSelector selector(ColumnSelectorFactory metricFactory)
NullableNumericAggregatorFactory
ColumnValueSelector
for the aggregated column.selector
in class NullableNumericAggregatorFactory<ColumnValueSelector>
ColumnValueSelector
protected VectorValueSelector vectorSelector(VectorColumnSelectorFactory columnSelectorFactory)
NullableNumericAggregatorFactory
VectorValueSelector
for the aggregated column.vectorSelector
in class NullableNumericAggregatorFactory<ColumnValueSelector>
VectorValueSelector
public Object deserialize(Object object)
AggregatorFactory
deserialize
in class AggregatorFactory
object
- the object to deserializepublic ColumnType getIntermediateType()
AggregatorFactory
ColumnType
for this aggregator. This is the same as the type returned by
AggregatorFactory.deserialize(java.lang.Object)
and the type accepted by AggregatorFactory.combine(java.lang.Object, java.lang.Object)
. However, it is *not* necessarily the same type
returned by AggregatorFactory.finalizeComputation(java.lang.Object)
.
Refer to the ColumnType
javadocs for details on the implications of choosing a type.getIntermediateType
in class AggregatorFactory
public int getMaxIntermediateSize()
AggregatorFactory
getMaxIntermediateSize
in class AggregatorFactory
public Comparator getComparator()
getComparator
in class AggregatorFactory
@Nullable public Object finalizeComputation(@Nullable Object object)
AggregatorFactory
finalizeComputation
in class AggregatorFactory
object
- the object to be finalizedpublic List<String> requiredFields()
AggregatorFactory
requiredFields
in class AggregatorFactory
public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException
AggregatorFactory
AggregatorFactoryNotMergeableException
, meaning that "this" and "other" are not
compatible and values from one cannot sensibly be combined with values from the other.getMergingFactory
in class AggregatorFactory
AggregatorFactoryNotMergeableException
which is equivalent to {@code foo.getMergingFactory(foo)} (when "this" and "other"
are the same instance).
public String getName()
getName
in class AggregatorFactory
public boolean canVectorize(ColumnInspector columnInspector)
AggregatorFactory
canVectorize
in class AggregatorFactory
protected abstract double nullValue()
protected abstract Aggregator buildAggregator(BaseDoubleColumnValueSelector selector)
protected abstract BufferAggregator buildBufferAggregator(BaseDoubleColumnValueSelector selector)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.