public class DoubleMaxAggregatorFactory extends SimpleDoubleAggregatorFactory
expression, fieldExpression, fieldName, macroTable, name, storeDoubleAsFloat
Constructor and Description |
---|
DoubleMaxAggregatorFactory(String name,
String fieldName) |
DoubleMaxAggregatorFactory(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, vectorSelector
factorize, factorizeBuffered, factorizeVector, getMaxIntermediateSizeWithNulls, getResultType, makeNullableAggregateCombiner
factorizeWithSize, getComplexTypeName, getFinalizedType, getType, guessAggregatorHeapFootprint, mergeAggregators, optimizeForSegment
public DoubleMaxAggregatorFactory(String name, String fieldName, @Nullable String expression, ExprMacroTable macroTable)
protected double nullValue()
nullValue
in class SimpleDoubleAggregatorFactory
protected Aggregator buildAggregator(BaseDoubleColumnValueSelector selector)
buildAggregator
in class SimpleDoubleAggregatorFactory
protected BufferAggregator buildBufferAggregator(BaseDoubleColumnValueSelector selector)
buildBufferAggregator
in class SimpleDoubleAggregatorFactory
protected VectorAggregator factorizeVector(VectorColumnSelectorFactory columnSelectorFactory, VectorValueSelector selector)
NullableNumericAggregatorFactory
VectorAggregator
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)
AggregatorFactory
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)
. 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 AggregatorFactory
lhs
- The left hand side of the combinerhs
- The right hand side of the combinepublic AggregateCombiner makeAggregateCombiner()
AggregatorFactory
AggregatorFactory.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 AggregatorFactory
AggregateCombiner
,
IndexMerger
public AggregatorFactory getCombiningFactory()
AggregatorFactory
CountAggregatorFactory
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 AggregatorFactory
public List<AggregatorFactory> getRequiredColumns()
AggregatorFactory
GroupByStrategyV1
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 AggregatorFactory
a similarly-named method that is perhaps the one you want instead.
public AggregatorFactory withName(String newName)
AggregatorFactory
org.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 AggregatorFactory
newName
- newName of the output for aggregator factorypublic byte[] getCacheKey()
Cacheable
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.