Package org.apache.druid.segment
Interface DimensionSelector
-
- All Superinterfaces:
BaseDoubleColumnValueSelector,BaseFloatColumnValueSelector,BaseLongColumnValueSelector,BaseNullableColumnValueSelector,BaseObjectColumnValueSelector<Object>,ColumnValueSelector<Object>,DimensionDictionarySelector,HotLoopCallee
- All Known Subinterfaces:
HistoricalDimensionSelector,SingleValueHistoricalDimensionSelector
- All Known Implementing Classes:
AbstractDimensionSelector,BaseSingleValueDimensionSelector,ConstantDimensionSelector,ConstantMultiValueDimensionSelector,DoubleWrappingDimensionSelector,ExpressionMultiValueDimensionSelector,FloatWrappingDimensionSelector,IndexedTableDimensionSelector,LongWrappingDimensionSelector,NestedFieldVirtualColumn.FieldDimensionSelector,PossiblyNullDimensionSelector,SettableDimensionValueSelector,SingleScanTimeDimensionSelector,SingleStringInputDeferredEvaluationExpressionDimensionSelector
public interface DimensionSelector extends ColumnValueSelector<Object>, DimensionDictionarySelector, HotLoopCallee
Selector for a string-typed column, either single- or multi-valued. This is named a "dimension" selector for legacy reasons: in the past, all Druid dimensions were string-typed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDimensionSelector.NullDimensionSelectorHolderThis class not a public API.
-
Field Summary
-
Fields inherited from interface org.apache.druid.segment.ColumnValueSelector
EMPTY_ARRAY
-
Fields inherited from interface org.apache.druid.segment.DimensionDictionarySelector
CARDINALITY_UNKNOWN
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static DimensionSelectorconstant(String value)static DimensionSelectorconstant(String value, ExtractionFn extractionFn)default ObjectdefaultGetObject()Converts the current result ofgetRow()into null, if the row is empty, a String, if the row has size 1, or aList<String>, if the row has size > 1, usingDimensionDictionarySelector.lookupName(int).default doublegetDouble()Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling.default floatgetFloat()Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling.default longgetLong()Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling.IndexedIntsgetRow()Returns the indexed values at the current position in this DimensionSelector.static booleanisNilSelector(DimensionSelector selector)Checks if the given selector constantly returns null.default booleanisNull()Deprecated.ValueMatchermakeValueMatcher(String value)ValueMatchermakeValueMatcher(DruidPredicateFactory predicateFactory)static DimensionSelectormultiConstant(List<String> values)static DimensionSelectormultiConstant(List<String> values, ExtractionFn extractionFn)static DimensionSelectornilSelector()static ObjectrowToObject(IndexedInts row, DimensionDictionarySelector selector)Converts a particularIndexedIntsto an Object in a standard way, assuming each element in the IndexedInts is a dictionary ID that can be resolved with the provided selector.-
Methods inherited from interface org.apache.druid.segment.BaseObjectColumnValueSelector
classOfObject, getObject
-
Methods inherited from interface org.apache.druid.segment.DimensionDictionarySelector
getValueCardinality, idLookup, lookupName, lookupNameUtf8, nameLookupPossibleInAdvance, supportsLookupNameUtf8
-
Methods inherited from interface org.apache.druid.query.monomorphicprocessing.HotLoopCallee
inspectRuntimeShape
-
-
-
-
Method Detail
-
getRow
@CalledFromHotLoop IndexedInts getRow()
Returns the indexed values at the current position in this DimensionSelector. IMPORTANT. The returnedIndexedIntsobject could generally be reused inside the implementation of DimensionSelector, i. e. this method could always return the same object for the same selector. Users of this API, such asAggregator.aggregate(),BufferAggregator.aggregate(java.nio.ByteBuffer, int),AggregateCombiner.reset(org.apache.druid.segment.ColumnValueSelector),AggregateCombiner.fold(org.apache.druid.segment.ColumnValueSelector)should be prepared for that and not storing the object returned from this method in their state, assuming that the object will remain unchanged even when the position of the selector changes. This may not be the case.
-
makeValueMatcher
ValueMatcher makeValueMatcher(@Nullable String value)
- Parameters:
value- nullable dimension value
-
makeValueMatcher
ValueMatcher makeValueMatcher(DruidPredicateFactory predicateFactory)
-
getFloat
@Deprecated default float getFloat()
Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling. "Polymorphism" of DimensionSelector should be used only when operating onColumnValueSelectorobjects.- Specified by:
getFloatin interfaceBaseFloatColumnValueSelector
-
getDouble
@Deprecated default double getDouble()
Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling. "Polymorphism" of DimensionSelector should be used only when operating onColumnValueSelectorobjects.- Specified by:
getDoublein interfaceBaseDoubleColumnValueSelector
-
getLong
@Deprecated default long getLong()
Deprecated.This method is marked as deprecated in DimensionSelector to minimize the probability of accidental calling. "Polymorphism" of DimensionSelector should be used only when operating onColumnValueSelectorobjects.- Specified by:
getLongin interfaceBaseLongColumnValueSelector
-
isNull
@Deprecated default boolean isNull()
Deprecated.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
-
defaultGetObject
@Nullable default Object defaultGetObject()
Converts the current result ofgetRow()into null, if the row is empty, a String, if the row has size 1, or aList<String>, if the row has size > 1, usingDimensionDictionarySelector.lookupName(int). This method is not the default implementation ofBaseObjectColumnValueSelector.getObject()to minimize the chance that implementations "forget" to override it with more optimized version.
-
rowToObject
@Nullable static Object rowToObject(IndexedInts row, DimensionDictionarySelector selector)
Converts a particularIndexedIntsto an Object in a standard way, assuming each element in the IndexedInts is a dictionary ID that can be resolved with the provided selector. Specification: 1) Empty row (IndexedInts.size()zero) returns null. 2) Single-value row returns a singleString. 3) Two+ value rows returnListofString.
-
nilSelector
static DimensionSelector nilSelector()
-
constant
static DimensionSelector constant(@Nullable String value)
-
constant
static DimensionSelector constant(@Nullable String value, @Nullable ExtractionFn extractionFn)
-
multiConstant
static DimensionSelector multiConstant(@Nullable List<String> values)
-
multiConstant
static DimensionSelector multiConstant(@Nullable List<String> values, @Nullable ExtractionFn extractionFn)
-
isNilSelector
static boolean isNilSelector(DimensionSelector selector)
Checks if the given selector constantly returns null. This method could be used in the beginning of execution of some queries and making some aggregations for heuristic shortcuts.
-
-