Class NullableNumericAggregateCombiner<T>
- java.lang.Object
-
- org.apache.druid.query.aggregation.NullableNumericAggregateCombiner<T>
-
- All Implemented Interfaces:
AggregateCombiner<T>,HotLoopCallee,BaseDoubleColumnValueSelector,BaseFloatColumnValueSelector,BaseLongColumnValueSelector,BaseNullableColumnValueSelector,BaseObjectColumnValueSelector<T>,ColumnValueSelector<T>
public final class NullableNumericAggregateCombiner<T> extends Object implements AggregateCombiner<T>
Null-aware numericAggregateCombiner. Used byAggregatorFactory.makeAggregateCombiner()to wrap non-null aware combiners. This class is only used when SQL compatible null handling is enabled.
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.segment.ColumnValueSelector
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description NullableNumericAggregateCombiner(AggregateCombiner<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassclassOfObject()Most-specific class of object returned byBaseObjectColumnValueSelector.getObject(), if known in advance.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.doublegetDouble()floatgetFloat()longgetLong()TgetObject()Returns the currently-selected object.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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.query.aggregation.AggregateCombiner
inspectRuntimeShape
-
-
-
-
Constructor Detail
-
NullableNumericAggregateCombiner
public NullableNumericAggregateCombiner(AggregateCombiner<T> delegate)
-
-
Method Detail
-
reset
public void reset(ColumnValueSelector selector)
Description copied from interface:AggregateCombinerResets 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 subsequentAggregateCombiner.fold(org.apache.druid.segment.ColumnValueSelector)calls.- Specified by:
resetin interfaceAggregateCombiner<T>
-
fold
public void fold(ColumnValueSelector selector)
Description copied from interface:AggregateCombinerFolds 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 beforeAggregateCombiner.reset(org.apache.druid.segment.ColumnValueSelector)is ever called on it, the effects of calling fold() are also undefined in this case.- Specified by:
foldin interfaceAggregateCombiner<T>- See Also:
AggregatorFactory.combine(java.lang.Object, java.lang.Object)
-
getFloat
public float getFloat()
- Specified by:
getFloatin interfaceBaseFloatColumnValueSelector
-
getDouble
public double getDouble()
- Specified by:
getDoublein interfaceBaseDoubleColumnValueSelector
-
getLong
public long getLong()
- Specified by:
getLongin interfaceBaseLongColumnValueSelector
-
isNull
public 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 interfaceAggregateCombiner<T>- Specified by:
isNullin interfaceBaseNullableColumnValueSelector
-
getObject
@Nullable public T getObject()
Description copied from interface:BaseObjectColumnValueSelectorReturns the currently-selected object. The behavior of this method depends on the type of selector, which can be determined by callingColumnSelectorFactory.getColumnCapabilities(String)on the sameColumnSelectorFactorythat you got this selector from. If the capabilties are nonnull, the selector type is given byTypeSignature.getType(). String selectors, where type isColumnType.STRING, may return any type of object from this method, especially in cases where the selector is casting objects to string at selection time. Callers are encouraged to avoid the need to deal with various objects by usingColumnSelectorFactory.makeDimensionSelector(org.apache.druid.query.dimension.DimensionSpec)instead. Numeric selectors, whereTypeSignature.isNumeric(), may return any type ofNumber. Callers that wish to deal with more specific types should treat the originalColumnValueSelectoras aBaseLongColumnValueSelector,BaseDoubleColumnValueSelector, orBaseFloatColumnValueSelectorinstead. Array selectors, whereTypeSignature.isArray(), must returnObject[]. The array may contain null elements, and the array itself may also be null. Selectors of unknown type, whereColumnSelectorFactory.getColumnCapabilities(String)returns null, may return any type of object. Callers must be prepared for a wide variety of possible input objects. This case is common during ingestion, where selectors are built on top of external data.- Specified by:
getObjectin interfaceBaseObjectColumnValueSelector<T>
-
classOfObject
public Class classOfObject()
Description copied from interface:BaseObjectColumnValueSelectorMost-specific class of object returned byBaseObjectColumnValueSelector.getObject(), if known in advance. This method returnsObjectwhen selectors do not know in advance what class of object they may return.- Specified by:
classOfObjectin interfaceBaseObjectColumnValueSelector<T>
-
-