public interface VirtualColumn extends Cacheable
ColumnSelectorFactory or ColumnSelector. They can
potentially draw from multiple underlying columns, although they always present themselves as if they were a single
column.
A virtual column object will be shared amongst threads and must be thread safe. The selectors returned
from the various makeXXXSelector methods need not be thread safe.| Modifier and Type | Method and Description |
|---|---|
default boolean |
canVectorize(ColumnInspector inspector) |
default ColumnCapabilities |
capabilities(ColumnInspector inspector,
String columnName)
Return the
ColumnCapabilities which best describe the optimal selector to read from this virtual column. |
ColumnCapabilities |
capabilities(String columnName)
Deprecated.
|
default BitmapIndex |
getBitmapIndex(String columnName,
ColumnSelector selector)
Returns the BitmapIndex for efficient filtering on columns that support it.
|
String |
getOutputName()
Output name of this column.
|
ColumnValueSelector<?> |
makeColumnValueSelector(String columnName,
ColumnSelectorFactory factory)
Build a
ColumnValueSelector corresponding to this virtual column. |
default ColumnValueSelector<?> |
makeColumnValueSelector(String columnName,
ColumnSelector columnSelector,
ReadableOffset offset)
Returns similar
ColumnValueSelector object as returned by
makeColumnValueSelector(String, ColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation. |
DimensionSelector |
makeDimensionSelector(DimensionSpec dimensionSpec,
ColumnSelectorFactory factory)
Build a selector corresponding to this virtual column.
|
default DimensionSelector |
makeDimensionSelector(DimensionSpec dimensionSpec,
ColumnSelector columnSelector,
ReadableOffset offset)
Returns similar
DimensionSelector object as returned by
makeDimensionSelector(DimensionSpec, ColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation. |
default MultiValueDimensionVectorSelector |
makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec,
ColumnSelector columnSelector,
ReadableVectorOffset offset)
Returns similar
SingleValueDimensionVectorSelector object as returned by
makeSingleValueVectorDimensionSelector(DimensionSpec, ColumnSelector, ReadableVectorOffset) except this
method has full access to the underlying column and can potentially provide a more efficient implementation. |
default MultiValueDimensionVectorSelector |
makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec,
VectorColumnSelectorFactory factory)
Build a
MultiValueDimensionVectorSelector corresponding to this virtual column. |
default SingleValueDimensionVectorSelector |
makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec,
ColumnSelector columnSelector,
ReadableVectorOffset offset)
Returns similar
SingleValueDimensionVectorSelector object as returned by
makeSingleValueVectorDimensionSelector(DimensionSpec, ColumnSelector, ReadableVectorOffset) except this
method has full access to the underlying column and can potentially provide a more efficient implementation. |
default SingleValueDimensionVectorSelector |
makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec,
VectorColumnSelectorFactory factory)
Build a
SingleValueDimensionVectorSelector corresponding to this virtual column. |
default VectorObjectSelector |
makeVectorObjectSelector(String columnName,
ColumnSelector columnSelector,
ReadableVectorOffset offset)
Returns similar
VectorObjectSelector object as returned by
makeVectorObjectSelector(String, VectorColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation. |
default VectorObjectSelector |
makeVectorObjectSelector(String columnName,
VectorColumnSelectorFactory factory)
Build a
VectorObjectSelector corresponding to this virtual column. |
default VectorValueSelector |
makeVectorValueSelector(String columnName,
ColumnSelector columnSelector,
ReadableVectorOffset offset)
Returns similar
VectorValueSelector object as returned by
makeVectorValueSelector(String, VectorColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation. |
default VectorValueSelector |
makeVectorValueSelector(String columnName,
VectorColumnSelectorFactory factory)
Build a
VectorValueSelector corresponding to this virtual column. |
List<String> |
requiredColumns()
Returns a list of columns that this virtual column will access.
|
boolean |
usesDotNotation()
Indicates that this virtual column can be referenced with dot notation.
|
getCacheKeyString getOutputName()
DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory)
DimensionSpec.getDimension(), which
is useful if this column uses dot notation. The virtual column is expected to apply any
necessary decoration from the dimensionSpec.@Nullable default DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelector columnSelector, ReadableOffset offset)
DimensionSelector object as returned by
makeDimensionSelector(DimensionSpec, ColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible. Typically this can not be called
in query paths on top of IncrementalIndex which doesn't have columns as in persisted segments.ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelectorFactory factory)
ColumnValueSelector corresponding to this virtual column. Also provides the name that the
virtual column was referenced with, which is useful if this column uses dot notation.@Nullable default ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelector columnSelector, ReadableOffset offset)
ColumnValueSelector object as returned by
makeColumnValueSelector(String, ColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible. Typically this can not be called
in query paths on top of IncrementalIndex which doesn't have columns as in persisted segments.default boolean canVectorize(ColumnInspector inspector)
default SingleValueDimensionVectorSelector makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory)
SingleValueDimensionVectorSelector corresponding to this virtual column. Also provides the name
that the virtual column was referenced with (through DimensionSpec.getDimension(), which is useful if this
column uses dot notation. The virtual column is expected to apply any necessary decoration from the
DimensionSpec.@Nullable default SingleValueDimensionVectorSelector makeSingleValueVectorDimensionSelector(DimensionSpec dimensionSpec, ColumnSelector columnSelector, ReadableVectorOffset offset)
SingleValueDimensionVectorSelector object as returned by
makeSingleValueVectorDimensionSelector(DimensionSpec, ColumnSelector, ReadableVectorOffset) except this
method has full access to the underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible.default MultiValueDimensionVectorSelector makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory)
MultiValueDimensionVectorSelector corresponding to this virtual column. Also provides
the name that the virtual column was referenced with (through DimensionSpec.getDimension(), which is useful
if this column uses dot notation. The virtual column is expected to apply any necessary decoration from the
DimensionSpec.@Nullable default MultiValueDimensionVectorSelector makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec, ColumnSelector columnSelector, ReadableVectorOffset offset)
SingleValueDimensionVectorSelector object as returned by
makeSingleValueVectorDimensionSelector(DimensionSpec, ColumnSelector, ReadableVectorOffset) except this
method has full access to the underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible.default VectorValueSelector makeVectorValueSelector(String columnName, VectorColumnSelectorFactory factory)
VectorValueSelector corresponding to this virtual column. Also provides the name that the
virtual column was referenced with, which is useful if this column uses dot notation.@Nullable default VectorValueSelector makeVectorValueSelector(String columnName, ColumnSelector columnSelector, ReadableVectorOffset offset)
VectorValueSelector object as returned by
makeVectorValueSelector(String, VectorColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible.default VectorObjectSelector makeVectorObjectSelector(String columnName, VectorColumnSelectorFactory factory)
VectorObjectSelector corresponding to this virtual column. Also provides the name that the
virtual column was referenced with, which is useful if this column uses dot notation.@Nullable default VectorObjectSelector makeVectorObjectSelector(String columnName, ColumnSelector columnSelector, ReadableVectorOffset offset)
VectorObjectSelector object as returned by
makeVectorObjectSelector(String, VectorColumnSelectorFactory) except this method has full access to the
underlying column and can potentially provide a more efficient implementation.
Users of this interface must ensure to first call this method whenever possible.@Deprecated ColumnCapabilities capabilities(String columnName)
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 from makeColumnValueSelector(String, ColumnSelectorFactory). May vary based on columnName
if this column uses dot notation.columnName - the name this virtual column was referenced withdefault ColumnCapabilities capabilities(ColumnInspector inspector, String columnName)
ColumnCapabilities which best describe the optimal selector to read from this virtual column.
The ColumnInspector (most likely corresponding to an underlying ColumnSelectorFactory of 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 the
ColumnInspector to infer the output type of expressions based on the types of the inputs.inspector - column inspector to provide additional information of other available columnscolumnName - the name this virtual column was referenced withList<String> requiredColumns()
boolean usesDotNotation()
default BitmapIndex getBitmapIndex(String columnName, ColumnSelector selector)
ColumnCapabilities returned from capabilities(String) has flag for BitmapIndex support.columnName - selector - Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.