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,ShimMultiValueDimensionSelector,ShimSingleValueDimensionSelector,ShimVectorObjectDimSelector,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 ClassesModifier and TypeInterfaceDescriptionstatic classThis class not a public API. -
Field Summary
Fields inherited from interface org.apache.druid.segment.ColumnValueSelector
EMPTY_ARRAYFields inherited from interface org.apache.druid.segment.DimensionDictionarySelector
CARDINALITY_UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionstatic DimensionSelectorstatic DimensionSelectorconstant(String value, ExtractionFn extractionFn) default ObjectConverts 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 doubleDeprecated.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.getRow()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.makeValueMatcher(String value) makeValueMatcher(DruidPredicateFactory predicateFactory) static DimensionSelectormultiConstant(List<String> values) static DimensionSelectormultiConstant(List<String> values, ExtractionFn extractionFn) static DimensionSelectorstatic 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, getObjectMethods inherited from interface org.apache.druid.segment.DimensionDictionarySelector
getValueCardinality, idLookup, lookupName, lookupNameUtf8, nameLookupPossibleInAdvance, supportsLookupNameUtf8Methods inherited from interface org.apache.druid.query.monomorphicprocessing.HotLoopCallee
inspectRuntimeShape
-
Method Details
-
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
- Parameters:
value- nullable dimension value
-
makeValueMatcher
-
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.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.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.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
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
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
-
constant
-
constant
-
multiConstant
-
multiConstant
static DimensionSelector multiConstant(@Nullable List<String> values, @Nullable ExtractionFn extractionFn) -
isNilSelector
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.
-