Class FallbackVirtualColumn
- All Implemented Interfaces:
Cacheable,VirtualColumn
If you are using this virtual column and want to have a decorator/extraction function on your DimensionSpec, it is expected that you will put it on the specs in the list rather than on the spec that references this virtual column. That is, when this virtual column resolves a dimension, it ignores the decoration from the spec that it was given and instead uses the spec as defined in the list as-is to delegate to the column that it chose.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.segment.VirtualColumn
VirtualColumn.EquivalenceKey -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanVectorize(ColumnInspector inspector) capabilities(String columnName) This method is deprecated in favor ofVirtualColumn.capabilities(ColumnInspector, String), which should be used whenever possible and can support virtual column implementations that need to inspect other columns as inputs.capabilities(ColumnInspector inspector, String columnName) Return theColumnCapabilitieswhich best describe the optimal selector to read from this virtual column.byte[]Get a byte array used as a cache key.getIndexSupplier(String columnName, ColumnIndexSelector indexSelector) Get theColumnIndexSupplierof the specified virtual column, with the assistance of aColumnSelectorto allow reading things from segments.Output name of this column.makeColumnValueSelector(String columnName, ColumnSelectorFactory factory) makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory) makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory) makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory) makeVectorObjectSelector(String columnName, VectorColumnSelectorFactory factory) makeVectorValueSelector(String columnName, VectorColumnSelectorFactory factory) Returns a list of columns that this virtual column will access.booleanIndicates that this virtual column can be referenced with dot notation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.segment.VirtualColumn
getEquivalanceKey, makeColumnValueSelector, makeColumnValueSelector, makeDimensionSelector, makeDimensionSelector, makeGroupByVectorColumnSelector, makeMultiValueVectorDimensionSelector, makeMultiValueVectorDimensionSelector, makeSingleValueVectorDimensionSelector, makeSingleValueVectorDimensionSelector, makeVectorObjectSelector, makeVectorObjectSelector, makeVectorValueSelector, makeVectorValueSelector, toSelectableColumn
-
Constructor Details
-
FallbackVirtualColumn
-
-
Method Details
-
getOutputName
Description copied from interface:VirtualColumnOutput name of this column.- Specified by:
getOutputNamein interfaceVirtualColumn- Returns:
- name
-
getColumns
-
getCacheKey
public byte[] getCacheKey()Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- bytes to be used as cache key - or null if this object should not be cached.
-
makeDimensionSelector
public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory) - Specified by:
makeDimensionSelectorin interfaceVirtualColumn
-
makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelectorFactory factory) - Specified by:
makeColumnValueSelectorin interfaceVirtualColumn
-
canVectorize
- Specified by:
canVectorizein interfaceVirtualColumn
-
makeSingleValueVectorDimensionSelector
public SingleValueDimensionVectorSelector makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory) - Specified by:
makeSingleValueVectorDimensionSelectorin interfaceVirtualColumn
-
makeMultiValueVectorDimensionSelector
public MultiValueDimensionVectorSelector makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory) - Specified by:
makeMultiValueVectorDimensionSelectorin interfaceVirtualColumn
-
makeVectorValueSelector
public VectorValueSelector makeVectorValueSelector(String columnName, VectorColumnSelectorFactory factory) - Specified by:
makeVectorValueSelectorin interfaceVirtualColumn
-
makeVectorObjectSelector
public VectorObjectSelector makeVectorObjectSelector(String columnName, VectorColumnSelectorFactory factory) - Specified by:
makeVectorObjectSelectorin interfaceVirtualColumn
-
capabilities
Description copied from interface:VirtualColumnThis method is deprecated in favor ofVirtualColumn.capabilities(ColumnInspector, String), which should be used whenever possible and can support virtual column implementations that need to inspect other columns as inputs. This is a fallback implementation to return the capabilities of this virtual column, which includes a type that corresponds to the best performing base selector supertype (e. g.BaseLongColumnValueSelector) of the object, returned fromVirtualColumn.makeColumnValueSelector(String, ColumnSelectorFactory). May vary based on columnName if this column uses dot notation.- Specified by:
capabilitiesin interfaceVirtualColumn- Parameters:
columnName- the name this virtual column was referenced with- Returns:
- capabilities, must not be null
-
capabilities
Description copied from interface:VirtualColumnReturn theColumnCapabilitieswhich best describe the optimal selector to read from this virtual column.The
ColumnInspector(most likely corresponding to an underlyingColumnSelectorFactoryof a query) allows the virtual column to consider this information if necessary to compute its output type details.Examples of this include the
ExpressionVirtualColumn, which takes input from other columns and uses theColumnInspectorto infer the output type of expressions based on the types of the inputs.- Specified by:
capabilitiesin interfaceVirtualColumn- Parameters:
inspector- column inspector to provide additional information of other available columnscolumnName- the name this virtual column was referenced with- Returns:
- capabilities, or null if the column should be treated as if it doesn't exist.
-
requiredColumns
Description copied from interface:VirtualColumnReturns a list of columns that this virtual column will access. This may include the names of other virtual columns. May be empty if a virtual column doesn't access any underlying columns. Does not pass columnName because there is an assumption that the list of columns needed by a dot-notation supporting virtual column will not vary based on the columnName.- Specified by:
requiredColumnsin interfaceVirtualColumn- Returns:
- column names
-
usesDotNotation
public boolean usesDotNotation()Description copied from interface:VirtualColumnIndicates that this virtual column can be referenced with dot notation. For example, a virtual column named "foo" could be referred to as "foo.bar" with the Cursor it is registered with. In that case, init will be called with columnName "foo.bar" rather than "foo".- Specified by:
usesDotNotationin interfaceVirtualColumn- Returns:
- whether to use dot notation
-
getIndexSupplier
@Nullable public ColumnIndexSupplier getIndexSupplier(String columnName, ColumnIndexSelector indexSelector) Description copied from interface:VirtualColumnGet theColumnIndexSupplierof the specified virtual column, with the assistance of aColumnSelectorto allow reading things from segments. Returns null if the virtual column wants to act like a missing column. ReturnsNoIndexesColumnIndexSupplier.getInstance()if the virtual column does not support indexes and wants cursor-based filtering.- Specified by:
getIndexSupplierin interfaceVirtualColumn
-