public class DoubleSumAggregatorFactory extends SimpleDoubleAggregatorFactory
expression, fieldExpression, fieldName, macroTable, name, storeDoubleAsFloat| Constructor and Description |
|---|
DoubleSumAggregatorFactory(String name,
String fieldName) |
DoubleSumAggregatorFactory(String name,
String fieldName,
String expression,
ExprMacroTable macroTable) |
| Modifier and Type | Method and Description |
|---|---|
protected Aggregator |
buildAggregator(BaseDoubleColumnValueSelector selector) |
protected BufferAggregator |
buildBufferAggregator(BaseDoubleColumnValueSelector selector) |
Object |
combine(Object lhs,
Object rhs)
A method that knows how to combine the outputs of
Aggregator.get() produced via AggregatorFactory.factorize(org.apache.druid.segment.ColumnSelectorFactory) or BufferAggregator.get(java.nio.ByteBuffer, int) produced via AggregatorFactory.factorizeBuffered(org.apache.druid.segment.ColumnSelectorFactory). |
protected VectorAggregator |
factorizeVector(VectorColumnSelectorFactory columnSelectorFactory,
VectorValueSelector selector)
Creates a
VectorAggregator to aggregate values from several rows into a ByteBuffer. |
byte[] |
getCacheKey()
Get a byte array used as a cache key.
|
AggregatorFactory |
getCombiningFactory()
Returns an AggregatorFactory that can be used to combine the output of aggregators from this factory.
|
List<AggregatorFactory> |
getRequiredColumns()
Used by
GroupByStrategyV1 when running nested groupBys, to
"transfer" values from this aggreagtor to an incremental index that the outer query will run on. |
AggregateCombiner |
makeAggregateCombiner()
Creates an AggregateCombiner to fold rollup aggregation results from serveral "rows" of different indexes during
index merging.
|
protected double |
nullValue() |
String |
toString() |
AggregatorFactory |
withName(String newName)
Used in cases where we want to change the output name of the aggregator to something else.
|
canVectorize, deserialize, equals, factorize, factorizeBuffered, finalizeComputation, getComparator, getExpression, getFieldName, getIntermediateType, getMaxIntermediateSize, getMergingFactory, getName, hashCode, requiredFields, selector, vectorSelectorfactorize, factorizeBuffered, factorizeVector, getMaxIntermediateSizeWithNulls, getResultType, makeNullableAggregateCombinerfactorizeWithSize, getComplexTypeName, getFinalizedType, getType, guessAggregatorHeapFootprint, mergeAggregators, optimizeForSegmentpublic DoubleSumAggregatorFactory(String name, String fieldName, @Nullable String expression, ExprMacroTable macroTable)
protected double nullValue()
nullValue in class SimpleDoubleAggregatorFactoryprotected Aggregator buildAggregator(BaseDoubleColumnValueSelector selector)
buildAggregator in class SimpleDoubleAggregatorFactoryprotected BufferAggregator buildBufferAggregator(BaseDoubleColumnValueSelector selector)
buildBufferAggregator in class SimpleDoubleAggregatorFactoryprotected VectorAggregator factorizeVector(VectorColumnSelectorFactory columnSelectorFactory, VectorValueSelector selector)
NullableNumericAggregatorFactoryVectorAggregator to aggregate values from several rows into a ByteBuffer.factorizeVector in class NullableNumericAggregatorFactory<ColumnValueSelector>columnSelectorFactory - columnSelectorFactory in case any other columns are needed.selector - VectorValueSelector for the column to aggregate.BufferAggregator@Nullable public Object combine(@Nullable Object lhs, @Nullable Object rhs)
AggregatorFactoryAggregator.get() produced via AggregatorFactory.factorize(org.apache.druid.segment.ColumnSelectorFactory) or BufferAggregator.get(java.nio.ByteBuffer, int) produced via AggregatorFactory.factorizeBuffered(org.apache.druid.segment.ColumnSelectorFactory). Note, even though this method is called "combine",
this method's contract *does* allow for mutation of the input objects. Thus, any use of lhs or rhs after calling
this method is highly discouraged.combine in class AggregatorFactorylhs - The left hand side of the combinerhs - The right hand side of the combinepublic AggregateCombiner makeAggregateCombiner()
AggregatorFactoryAggregatorFactory.combine(java.lang.Object, java.lang.Object), with the difference that it uses
ColumnValueSelector and it's subinterfaces to get inputs and implements ColumnValueSelector to provide output.makeAggregateCombiner in class AggregatorFactoryAggregateCombiner,
IndexMergerpublic AggregatorFactory getCombiningFactory()
AggregatorFactoryCountAggregatorFactory getCombiningFactory method will return a
LongSumAggregatorFactory, because counts are combined by summing.
No matter what, `foo.getCombiningFactory()` and `foo.getCombiningFactory().getCombiningFactory()` should return
the same result.getCombiningFactory in class AggregatorFactorypublic List<AggregatorFactory> getRequiredColumns()
AggregatorFactoryGroupByStrategyV1 when running nested groupBys, to
"transfer" values from this aggreagtor to an incremental index that the outer query will run on. This method
only exists due to the design of GroupByStrategyV1, and should probably not be used for anything else. If you are
here because you are looking for a way to get the input fields required by this aggregator, and thought
"getRequiredColumns" sounded right, please use AggregatorFactory.requiredFields() instead.getRequiredColumns in class AggregatorFactorya similarly-named method that is perhaps the one you want instead.public AggregatorFactory withName(String newName)
AggregatorFactoryorg.apache.druid.sql.calcite.rel.DruidQuery#computeAggregations. We can use withName("total") to set the output name
of the aggregator to "total".
As all implementations of this interface method may not exist, callers of this method are advised to handle such a case.
withName in class AggregatorFactorynewName - newName of the output for aggregator factorypublic byte[] getCacheKey()
CacheableCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.