public abstract class SimpleLongAggregatorFactory extends NullableNumericAggregatorFactory<ColumnValueSelector>
AggregatorFactory implementations that consume long input
and produce long output on aggregation.
It extends "NullableAggregatorFactory| Modifier 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 |
| Constructor and Description |
|---|
SimpleLongAggregatorFactory(ExprMacroTable macroTable,
String name,
String fieldName,
String expression) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Aggregator |
buildAggregator(BaseLongColumnValueSelector selector) |
protected abstract BufferAggregator |
buildBufferAggregator(BaseLongColumnValueSelector selector) |
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() |
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() |
String |
getTypeName()
Get the type name of the intermediate type for this aggregator.
|
int |
hashCode() |
protected abstract long |
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. |
factorize, factorizeBuffered, factorizeVector, factorizeVector, getMaxIntermediateSizeWithNulls, makeNullableAggregateCombiner, vectorSelectorcanVectorize, combine, getCombiningFactory, getRequiredColumns, makeAggregateCombiner, mergeAggregators, optimizeForSegmentclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetCacheKeyprotected final String name
protected final ExprMacroTable macroTable
protected final com.google.common.base.Supplier<Expr> fieldExpression
protected Aggregator factorize(ColumnSelectorFactory metricFactory, ColumnValueSelector selector)
NullableNumericAggregatorFactoryAggregator to aggregate values from several rows, by using the provided selector.factorize in class NullableNumericAggregatorFactory<ColumnValueSelector>metricFactory - metricFactoryselector - ColumnValueSelector for the column to aggregate.Aggregatorprotected BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory, ColumnValueSelector selector)
NullableNumericAggregatorFactoryBufferAggregator 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.BufferAggregatorprotected ColumnValueSelector selector(ColumnSelectorFactory metricFactory)
NullableNumericAggregatorFactoryColumnValueSelector for the aggregated column.selector in class NullableNumericAggregatorFactory<ColumnValueSelector>ColumnValueSelectorpublic Object deserialize(Object object)
AggregatorFactorydeserialize in class AggregatorFactoryobject - the object to deserializepublic String getTypeName()
AggregatorFactoryAggregatorFactory.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).
If the type is complex (i.e. not a simple, numeric ValueType) then there
must be a corresponding ComplexMetricSerde which was registered with
ComplexMetrics.registerSerde(java.lang.String, org.apache.druid.segment.serde.ComplexMetricSerde) using this type name.
If you need a ValueType enum corresponding to this aggregator, a good way to do that is:
Optional.ofNullable(GuavaUtils.getEnumIfPresent(ValueType.class, aggregator.getTypeName()))
.orElse(ValueType.COMPLEX);
getTypeName in class AggregatorFactorypublic int getMaxIntermediateSize()
AggregatorFactorygetMaxIntermediateSize in class AggregatorFactorypublic Comparator getComparator()
getComparator in class AggregatorFactory@Nullable public Object finalizeComputation(@Nullable Object object)
AggregatorFactoryfinalizeComputation in class AggregatorFactoryobject - the object to be finalizedpublic List<String> requiredFields()
AggregatorFactoryrequiredFields in class AggregatorFactorypublic AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException
AggregatorFactoryAggregatorFactoryNotMergeableException, meaning that "this" and "other" are not
compatible and values from one cannot sensibly be combined with values from the other.getMergingFactory in class AggregatorFactoryAggregatorFactoryNotMergeableExceptionwhich is equivalent to {@code foo.getMergingFactory(foo)} (when "this" and "other"
are the same instance).public String getName()
getName in class AggregatorFactoryprotected abstract long nullValue()
protected abstract Aggregator buildAggregator(BaseLongColumnValueSelector selector)
protected abstract BufferAggregator buildBufferAggregator(BaseLongColumnValueSelector selector)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.