public class HyperUniquesAggregatorFactory extends AggregatorFactory
| Constructor and Description |
|---|
HyperUniquesAggregatorFactory(String name,
String fieldName) |
HyperUniquesAggregatorFactory(String name,
String fieldName,
boolean isInputHyperUnique,
boolean round) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canVectorize(ColumnInspector columnInspector)
Returns whether or not this aggregation class supports vectorization.
|
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). |
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) |
static Object |
estimateCardinality(Object object,
boolean round) |
Aggregator |
factorize(ColumnSelectorFactory metricFactory) |
BufferAggregator |
factorizeBuffered(ColumnSelectorFactory metricFactory) |
VectorAggregator |
factorizeVector(VectorColumnSelectorFactory selectorFactory)
Create a VectorAggregator based on the provided column selector factory.
|
Object |
finalizeComputation(Object object)
"Finalizes" the computation of an object.
|
byte[] |
getCacheKey() |
AggregatorFactory |
getCombiningFactory()
Returns an AggregatorFactory that can be used to combine the output of aggregators from this factory.
|
Comparator |
getComparator() |
String |
getFieldName() |
boolean |
getIsInputHyperUnique() |
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() |
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. |
String |
getTypeName()
Get the type name of the intermediate type for this aggregator.
|
int |
hashCode() |
boolean |
isRound() |
AggregateCombiner |
makeAggregateCombiner()
Creates an AggregateCombiner to fold rollup aggregation results from serveral "rows" of different indexes during
index merging.
|
List<String> |
requiredFields()
Get a list of fields that aggregators built by this factory will need to read.
|
String |
toString() |
getMaxIntermediateSizeWithNulls, makeNullableAggregateCombiner, mergeAggregators, optimizeForSegmentpublic HyperUniquesAggregatorFactory(String name, String fieldName, boolean isInputHyperUnique, boolean round)
public static Object estimateCardinality(@Nullable Object object, boolean round)
public Aggregator factorize(ColumnSelectorFactory metricFactory)
factorize in class AggregatorFactorypublic BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory)
factorizeBuffered in class AggregatorFactorypublic VectorAggregator factorizeVector(VectorColumnSelectorFactory selectorFactory)
AggregatorFactoryfactorizeVector in class AggregatorFactorypublic boolean canVectorize(ColumnInspector columnInspector)
AggregatorFactorycanVectorize in class AggregatorFactorypublic Comparator getComparator()
getComparator in class AggregatorFactorypublic Object combine(Object lhs, 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 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 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 Object deserialize(Object object)
AggregatorFactorydeserialize in class AggregatorFactoryobject - the object to deserialize@Nullable public Object finalizeComputation(@Nullable Object object)
AggregatorFactoryfinalizeComputation in class AggregatorFactoryobject - the object to be finalizedpublic String getName()
getName in class AggregatorFactorypublic List<String> requiredFields()
AggregatorFactoryrequiredFields in class AggregatorFactorypublic String getFieldName()
public boolean getIsInputHyperUnique()
public boolean isRound()
public byte[] getCacheKey()
public 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 AggregatorFactoryCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.