public interface DimensionSelector extends ColumnValueSelector<Object>, HotLoopCallee
| Modifier and Type | Interface and Description |
|---|---|
static class |
DimensionSelector.NullDimensionSelectorHolder
This class not a public API.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CARDINALITY_UNKNOWN |
EMPTY_ARRAY| Modifier and Type | Method and Description |
|---|---|
static DimensionSelector |
constant(String value) |
static DimensionSelector |
constant(String value,
ExtractionFn extractionFn) |
default Object |
defaultGetObject()
Converts the current result of
getRow() into null, if the row is empty, a String, if the row has size 1,
or a String[] array, if the row has size > 1, using lookupName(int). |
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 on
ColumnValueSelector
objects. |
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 on
ColumnValueSelector
objects. |
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 on
ColumnValueSelector
objects. |
IndexedInts |
getRow()
Returns the indexed values at the current position in this DimensionSelector.
|
int |
getValueCardinality()
Value cardinality is the cardinality of the different occurring values.
|
IdLookup |
idLookup()
Returns
IdLookup if available for this DimensionSelector, or null. |
static boolean |
isNilSelector(DimensionSelector selector)
Checks if the given selector constantly returns null.
|
default boolean |
isNull()
Deprecated.
|
String |
lookupName(int id)
The Name is the String name of the actual field.
|
ValueMatcher |
makeValueMatcher(com.google.common.base.Predicate<String> predicate) |
ValueMatcher |
makeValueMatcher(String value) |
boolean |
nameLookupPossibleInAdvance()
Returns true if it is possible to
lookupName(int) by ids from 0 to getValueCardinality()
before the rows with those ids are returned. |
inspectRuntimeShapeclassOfObject, getObjectstatic final int CARDINALITY_UNKNOWN
@CalledFromHotLoop IndexedInts getRow()
IndexedInts object 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 as Aggregator.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.ValueMatcher makeValueMatcher(@Nullable String value)
value - nullable dimension valueValueMatcher makeValueMatcher(com.google.common.base.Predicate<String> predicate)
int getValueCardinality()
@CalledFromHotLoop @Nullable String lookupName(int id)
id - id to lookup the field name forboolean nameLookupPossibleInAdvance()
lookupName(int) by ids from 0 to getValueCardinality()
before the rows with those ids are returned.
Returns false if lookupName(int) could be called with ids, returned from the most recent call of getRow() on this DimensionSelector, but not earlier. If getValueCardinality() of this DimensionSelector
additionally returns CARDINALITY_UNKNOWN, lookupName() couldn't be called with ids, returned by
not the most recent call of getRow(), i. e. names for ids couldn't be looked up "later". If getValueCardinality() returns a non-negative number, lookupName() could be called with any ids, returned
from #getRow() since the creation of this DimensionSelector.
If lookupName(int) is called with an ineligible id, result is undefined: exception could be thrown, or
null returned, or some other random value.
@Nullable IdLookup idLookup()
IdLookup if available for this DimensionSelector, or null.@Deprecated default float getFloat()
ColumnValueSelector
objects.getFloat in interface BaseFloatColumnValueSelector@Deprecated default double getDouble()
ColumnValueSelector
objects.getDouble in interface BaseDoubleColumnValueSelector@Deprecated default long getLong()
ColumnValueSelector
objects.getLong in interface BaseLongColumnValueSelector@Deprecated default boolean isNull()
BaseNullableColumnValueSelectorBaseFloatColumnValueSelector,
BaseLongColumnValueSelector and BaseDoubleColumnValueSelector otherwise false.isNull in interface BaseNullableColumnValueSelector@Nullable default Object defaultGetObject()
getRow() into null, if the row is empty, a String, if the row has size 1,
or a String[] array, if the row has size > 1, using lookupName(int).
This method is not the default implementation of BaseObjectColumnValueSelector.getObject() to minimize the chance that implementations
"forget" to override it with more optimized version.static DimensionSelector constant(@Nullable String value)
static DimensionSelector constant(@Nullable String value, @Nullable ExtractionFn extractionFn)
static boolean isNilSelector(DimensionSelector selector)
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.