Interface AggregateCombiner<T>
-
- All Superinterfaces:
BaseDoubleColumnValueSelector,BaseFloatColumnValueSelector,BaseLongColumnValueSelector,BaseNullableColumnValueSelector,BaseObjectColumnValueSelector<T>,ColumnValueSelector<T>,HotLoopCallee
- All Known Implementing Classes:
DoubleAggregateCombiner,GenericFirstAggregateCombiner,GenericLastAggregateCombiner,HyperLogLogCollectorAggregateCombiner,LongAggregateCombiner,LongSumAggregateCombiner,NullableNumericAggregateCombiner,ObjectAggregateCombiner
public interface AggregateCombiner<T> extends ColumnValueSelector<T>
AggregateCombiner is used to fold rollup aggregation results from serveral "rows" of different indexes during index merging (seeIndexMerger). The state of the implementations of this interface is an aggregation value (either a primitive or an object), that could be queried viaColumnValueSelector's methods. Beforereset(org.apache.druid.segment.ColumnValueSelector)is ever called on an AggregateCombiner, it's state is undefined andColumnValueSelector's methods could return something random, or null, or throw an exception. This interface would probably better be called "AggregateFolder", but somebody may confuse it with "folder" as "directory" synonym.
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.segment.ColumnValueSelector
EMPTY_ARRAY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidfold(ColumnValueSelector selector)Folds this AggregateCombiner's state value with the value of the given selector and saves it in this AggregateCombiner's state, e.default voidinspectRuntimeShape(RuntimeShapeInspector inspector)Implementations of this method should callinspector.visit()with all fields of this class, which meet two conditions: 1.default booleanisNull()Returns true if the primitive long, double, or float value returned by this selector should be treated as null.voidreset(ColumnValueSelector selector)Resets this AggregateCombiner's state value to the value of the given selector, e.-
Methods inherited from interface org.apache.druid.segment.BaseDoubleColumnValueSelector
getDouble
-
Methods inherited from interface org.apache.druid.segment.BaseFloatColumnValueSelector
getFloat
-
Methods inherited from interface org.apache.druid.segment.BaseLongColumnValueSelector
getLong
-
Methods inherited from interface org.apache.druid.segment.BaseObjectColumnValueSelector
classOfObject, getObject
-
-
-
-
Method Detail
-
reset
void reset(ColumnValueSelector selector)
Resets this AggregateCombiner's state value to the value of the given selector, e. g. after calling this method combiner.get*() should return the same value as selector.get*(). If the selector is anObjectColumnSelector, the object returned fromBaseObjectColumnValueSelector.getObject()must not be modified, and must not become a subject for modification during subsequentfold(org.apache.druid.segment.ColumnValueSelector)calls.
-
fold
void fold(ColumnValueSelector selector)
Folds this AggregateCombiner's state value with the value of the given selector and saves it in this AggregateCombiner's state, e. g. after calling combiner.fold(selector), combiner.get*() should return the value that would be the result ofaggregatorFactory.combine(combiner.get*(), selector.get*())call. UnlikeAggregatorFactory.combine(java.lang.Object, java.lang.Object), if the selector is anObjectColumnSelector, the object returned fromBaseObjectColumnValueSelector.getObject()must not be modified, and must not become a subject for modification during subsequent fold() calls. Since the state of AggregateCombiner is undefined beforereset(org.apache.druid.segment.ColumnValueSelector)is ever called on it, the effects of calling fold() are also undefined in this case.
-
isNull
default boolean isNull()
Description copied from interface:BaseNullableColumnValueSelectorReturns true if the primitive long, double, or float value returned by this selector should be treated as null. Users ofBaseLongColumnValueSelector.getLong(),BaseDoubleColumnValueSelector.getDouble()andBaseFloatColumnValueSelector.getFloat()must check this method first, or else they may improperly use placeholder values returned by the primitive get methods. Users ofBaseObjectColumnValueSelector.getObject()should not call this method. Instead, call "getObject" and check if it is null.- Specified by:
isNullin interfaceBaseNullableColumnValueSelector
-
inspectRuntimeShape
default void inspectRuntimeShape(RuntimeShapeInspector inspector)
Description copied from interface:HotLoopCalleeImplementations of this method should callinspector.visit()with all fields of this class, which meet two conditions: 1. They are used in methods of this class, annotated withCalledFromHotLoop2. They are either: a. Nullable objects b. Instances of HotLoopCallee c. Objects, which don't always have a specific class in runtime. For example, a field of typeSetcould beHashSetorTreeSetin runtime, depending on how this instance (the instance on which inspectRuntimeShape() is called) is configured. d. ByteBuffer or similar objects, where byte order matters e. boolean flags, affecting branch taking f. Arrays of objects, meeting any of conditions a-e.- Specified by:
inspectRuntimeShapein interfaceHotLoopCallee
-
-