public class SingleStringInputDeferredEvaluationExpressionDimensionSelector extends Object implements DimensionSelector
DimensionSelector decorator that directly exposes the underlying dictionary id in getRow(),
saving expression computation until lookupName(int) is called. This allows for performing operations like
grouping on the native dictionary ids, and deferring expression evaluation until after which can dramatically
reduce the total number of evaluations.DimensionSelector.NullDimensionSelectorHolderEMPTY_ARRAYCARDINALITY_UNKNOWN| Constructor and Description |
|---|
SingleStringInputDeferredEvaluationExpressionDimensionSelector(DimensionSelector selector,
Expr expression) |
| Modifier and Type | Method and Description |
|---|---|
Class |
classOfObject() |
Object |
getObject() |
IndexedInts |
getRow()
Get the underlying selector
IndexedInts row |
int |
getValueCardinality()
Value cardinality is the cardinality of the different occurring values.
|
IdLookup |
idLookup()
Returns
IdLookup if available for this DimensionSelector, or null. |
void |
inspectRuntimeShape(RuntimeShapeInspector inspector)
Implementations of this method should call
inspector.visit() with all fields of this class, which meet two
conditions:
1. |
String |
lookupName(int id)
Returns the value for a particular dictionary id as a Java String.
|
ValueMatcher |
makeValueMatcher(com.google.common.base.Predicate<String> predicate) |
ValueMatcher |
makeValueMatcher(String value) |
boolean |
nameLookupPossibleInAdvance()
Returns true if it is possible to
DimensionDictionarySelector.lookupName(int) by ids from 0 to DimensionDictionarySelector.getValueCardinality()
before the rows with those ids are returned. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconstant, constant, defaultGetObject, getDouble, getFloat, getLong, isNilSelector, isNull, multiConstant, multiConstant, nilSelector, rowToObjectlookupNameUtf8, supportsLookupNameUtf8public SingleStringInputDeferredEvaluationExpressionDimensionSelector(DimensionSelector selector, Expr expression)
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
HotLoopCalleeinspector.visit() with all fields of this class, which meet two
conditions:
1. They are used in methods of this class, annotated with CalledFromHotLoop
2. 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 type Set could be HashSet or TreeSet in 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.inspectRuntimeShape in interface HotLoopCalleepublic IndexedInts getRow()
IndexedInts rowgetRow in interface DimensionSelectorpublic ValueMatcher makeValueMatcher(@Nullable String value)
makeValueMatcher in interface DimensionSelectorvalue - nullable dimension valuepublic ValueMatcher makeValueMatcher(com.google.common.base.Predicate<String> predicate)
makeValueMatcher in interface DimensionSelectorpublic int getValueCardinality()
DimensionDictionarySelectorgetValueCardinality in interface DimensionDictionarySelectorDimensionDictionarySelector.CARDINALITY_UNKNOWN if unknown.public String lookupName(int id)
DimensionDictionarySelectorjava.lang.String, always use this method. It will be at least as fast
as calling DimensionDictionarySelector.lookupNameUtf8(int) and decoding the bytes. However, if you want UTF-8 bytes, then check if
DimensionDictionarySelector.supportsLookupNameUtf8() returns true, and if it does, use DimensionDictionarySelector.lookupNameUtf8(int) instead.lookupName in interface DimensionDictionarySelectorid - id to lookup the dictionary value forpublic boolean nameLookupPossibleInAdvance()
DimensionDictionarySelectorDimensionDictionarySelector.lookupName(int) by ids from 0 to DimensionDictionarySelector.getValueCardinality()
before the rows with those ids are returned.
Returns false if DimensionDictionarySelector.lookupName(int) could be called with ids, returned from the most recent row (or row
vector) returned by this DimensionSelector, but not earlier. If DimensionDictionarySelector.getValueCardinality() of this
selector additionally returns DimensionDictionarySelector.CARDINALITY_UNKNOWN, lookupName() couldn't be called with
ids, returned by not the most recent row (or row vector), i. e. names for ids couldn't be looked up "later". If
DimensionDictionarySelector.getValueCardinality() returns a non-negative number, lookupName() could be called with any ids,
returned from rows (or row vectors) returned since the creation of this DimensionSelector.
If DimensionDictionarySelector.lookupName(int) is called with an ineligible id, result is undefined: exception could be thrown, or
null returned, or some other random value.
nameLookupPossibleInAdvance in interface DimensionDictionarySelector@Nullable public IdLookup idLookup()
DimensionDictionarySelectorIdLookup if available for this DimensionSelector, or null.idLookup in interface DimensionDictionarySelector@Nullable public Object getObject()
getObject in interface BaseObjectColumnValueSelector<Object>public Class classOfObject()
classOfObject in interface BaseObjectColumnValueSelector<Object>Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.