Class NilVectorSelector
- java.lang.Object
-
- org.apache.druid.segment.vector.NilVectorSelector
-
- All Implemented Interfaces:
DimensionDictionarySelector,IdLookup,SingleValueDimensionVectorSelector,VectorObjectSelector,VectorSizeInspector,VectorValueSelector
public class NilVectorSelector extends Object implements VectorValueSelector, VectorObjectSelector, SingleValueDimensionVectorSelector, IdLookup
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.segment.DimensionDictionarySelector
CARDINALITY_UNKNOWN
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NilVectorSelectorcreate(VectorSizeInspector vectorSizeInspector)intgetCurrentVectorSize()Returns the current vector size for this cursor.double[]getDoubleVector()Get the current vector, casting to doubles as necessary.float[]getFloatVector()Get the current vector, casting to floats as necessary.long[]getLongVector()Get the current vector, casting to longs as necessary.intgetMaxVectorSize()Returns the maximum vector size for this cursor.boolean[]getNullVector()Gets a vector of booleans signifying which rows are null and which are not (true for null).Object[]getObjectVector()Get the current vector.int[]getRowVector()Get the current vector.intgetValueCardinality()Value cardinality is the cardinality of the different occurring values.IdLookupidLookup()ReturnsIdLookupif available for this DimensionSelector, or null.intlookupId(String name)Inverse ofDimensionDictionarySelector.lookupName(int).StringlookupName(int id)Returns the value for a particular dictionary id as a Java String.booleannameLookupPossibleInAdvance()Returns true if it is possible toDimensionDictionarySelector.lookupName(int)by ids from 0 toDimensionDictionarySelector.getValueCardinality()before the rows with those ids are returned.-
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.segment.DimensionDictionarySelector
lookupNameUtf8, supportsLookupNameUtf8
-
-
-
-
Method Detail
-
create
public static NilVectorSelector create(VectorSizeInspector vectorSizeInspector)
-
getLongVector
public long[] getLongVector()
Description copied from interface:VectorValueSelectorGet the current vector, casting to longs as necessary. The array will be reused, so it is not a good idea to retain a reference to it.- Specified by:
getLongVectorin interfaceVectorValueSelector
-
getFloatVector
public float[] getFloatVector()
Description copied from interface:VectorValueSelectorGet the current vector, casting to floats as necessary. The array will be reused, so it is not a good idea to retain a reference to it.- Specified by:
getFloatVectorin interfaceVectorValueSelector
-
getDoubleVector
public double[] getDoubleVector()
Description copied from interface:VectorValueSelectorGet the current vector, casting to doubles as necessary. The array will be reused, so it is not a good idea to retain a reference to it.- Specified by:
getDoubleVectorin interfaceVectorValueSelector
-
getNullVector
@Nullable public boolean[] getNullVector()
Description copied from interface:VectorValueSelectorGets a vector of booleans signifying which rows are null and which are not (true for null). Returns null if it is known that there are no nulls in the vector, possibly because the column is non-nullable.- Specified by:
getNullVectorin interfaceVectorValueSelector
-
getRowVector
public int[] getRowVector()
Description copied from interface:SingleValueDimensionVectorSelectorGet the current vector. The array will be reused, so it is not a good idea to retain a reference to it.- Specified by:
getRowVectorin interfaceSingleValueDimensionVectorSelector
-
getValueCardinality
public int getValueCardinality()
Description copied from interface:DimensionDictionarySelectorValue cardinality is the cardinality of the different occurring values. If there were 4 rows: A,B A B A Value cardinality would be 2. Cardinality may be unknown (e.g. the selector used by IncrementalIndex while reading input rows), in which case this method will return -1. If cardinality is unknown, you should assume this dimension selector has no dictionary, and avoid storing ids, calling "lookupId", or calling "lookupName" outside of the context of operating on a single row. If cardinality is known then it is assumed that underlying dictionary is lexicographically sorted by the encoded value. For example if there are values "A" , "B" , "C" in a column with cardinality 3 then it is assumed that id("A") < id("B") < id("C")- Specified by:
getValueCardinalityin interfaceDimensionDictionarySelector- Returns:
- the value cardinality, or
DimensionDictionarySelector.CARDINALITY_UNKNOWNif unknown.
-
lookupName
@Nullable public String lookupName(int id)
Description copied from interface:DimensionDictionarySelectorReturns the value for a particular dictionary id as a Java String. For example, if a column has four rows: A,B A A,B B getRow() would return getRow(0) => [0 1] getRow(1) => [0] getRow(2) => [0 1] getRow(3) => [1] and then lookupName would return: lookupName(0) => A lookupName(1) => B Performance note: if you want ajava.lang.String, always use this method. It will be at least as fast as callingDimensionDictionarySelector.lookupNameUtf8(int)and decoding the bytes. However, if you want UTF-8 bytes, then check ifDimensionDictionarySelector.supportsLookupNameUtf8()returns true, and if it does, useDimensionDictionarySelector.lookupNameUtf8(int)instead.- Specified by:
lookupNamein interfaceDimensionDictionarySelector- Parameters:
id- id to lookup the dictionary value for- Returns:
- dictionary value for the given id, or null if the value is itself null
-
nameLookupPossibleInAdvance
public boolean nameLookupPossibleInAdvance()
Description copied from interface:DimensionDictionarySelectorReturns true if it is possible toDimensionDictionarySelector.lookupName(int)by ids from 0 toDimensionDictionarySelector.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. IfDimensionDictionarySelector.getValueCardinality()of this selector additionally returnsDimensionDictionarySelector.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". IfDimensionDictionarySelector.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.- Specified by:
nameLookupPossibleInAdvancein interfaceDimensionDictionarySelector
-
idLookup
@Nullable public IdLookup idLookup()
Description copied from interface:DimensionDictionarySelectorReturnsIdLookupif available for this DimensionSelector, or null.- Specified by:
idLookupin interfaceDimensionDictionarySelector
-
lookupId
public int lookupId(@Nullable String name)
Description copied from interface:IdLookupInverse ofDimensionDictionarySelector.lookupName(int).
-
getObjectVector
public Object[] getObjectVector()
Description copied from interface:VectorObjectSelectorGet the current vector. The type of objects in the array depends on the type of the selector. Callers can determine this by callingVectorColumnSelectorFactory.getColumnCapabilities(String)if creating selectors directly. Alternatively, callers usingVectorColumnProcessorFactorywill receive capabilities as part of the callback toVectorColumnProcessorFactory.makeObjectProcessor(ColumnCapabilities, VectorObjectSelector). String selectors, where type isColumnType.STRING, must use objects compatible with the spec ofDimensionSelector.rowToObject(IndexedInts, DimensionDictionarySelector). Array selectors, whereTypeSignature.isArray(), must useObject[]. The array may contain null elements, and the array itself may also be null. Complex selectors may use any type of object. No other type of selector is possible. Vector object selectors are only used for strings, arrays, and complex types.- Specified by:
getObjectVectorin interfaceVectorObjectSelector
-
getCurrentVectorSize
public int getCurrentVectorSize()
Description copied from interface:VectorSizeInspectorReturns the current vector size for this cursor. Will never be larger than the max size returned byVectorSizeInspector.getMaxVectorSize().- Specified by:
getCurrentVectorSizein interfaceVectorSizeInspector
-
getMaxVectorSize
public int getMaxVectorSize()
Description copied from interface:VectorSizeInspectorReturns the maximum vector size for this cursor. It will not change for the lifetime of this cursor, and is generally used to allocate scratch arrays for later processing. Will always be greater than zero.- Specified by:
getMaxVectorSizein interfaceVectorSizeInspector
-
-