Package org.apache.druid.segment.virtual
Class ListFilteredVirtualColumn
- java.lang.Object
-
- org.apache.druid.segment.virtual.ListFilteredVirtualColumn
-
- All Implemented Interfaces:
Cacheable
,VirtualColumn
public class ListFilteredVirtualColumn extends Object implements VirtualColumn
-
-
Constructor Summary
Constructors Constructor Description ListFilteredVirtualColumn(String name, DimensionSpec delegate, Set<String> values, Boolean isAllowList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnCapabilities
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.ColumnCapabilities
capabilities(ColumnInspector inspector, String columnName)
Return theColumnCapabilities
which best describe the optimal selector to read from this virtual column.boolean
equals(Object o)
byte[]
getCacheKey()
Get a byte array used as a cache key.DimensionSpec
getDelegate()
ColumnIndexSupplier
getIndexSupplier(String columnName, ColumnSelector columnSelector)
Get theColumnIndexSupplier
for the specified virtual column, with the assistance of aColumnSelector
to allow reading things from segments.String
getOutputName()
Output name of this column.Set<String>
getValues()
int
hashCode()
boolean
isAllowList()
ColumnValueSelector<?>
makeColumnValueSelector(String columnName, ColumnSelectorFactory factory)
Build aColumnValueSelector
corresponding to this virtual column.DimensionSelector
makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory)
Build a selector corresponding to this virtual column.List<String>
requiredColumns()
Returns a list of columns that this virtual column will access.String
toString()
boolean
usesDotNotation()
Indicates that this virtual column can be referenced with dot notation.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.VirtualColumn
canVectorize, makeColumnValueSelector, makeDimensionSelector, makeMultiValueVectorDimensionSelector, makeMultiValueVectorDimensionSelector, makeSingleValueVectorDimensionSelector, makeSingleValueVectorDimensionSelector, makeVectorObjectSelector, makeVectorObjectSelector, makeVectorValueSelector, makeVectorValueSelector
-
-
-
-
Method Detail
-
getOutputName
public String getOutputName()
Description copied from interface:VirtualColumn
Output name of this column.- Specified by:
getOutputName
in interfaceVirtualColumn
- Returns:
- name
-
isAllowList
public boolean isAllowList()
-
getDelegate
public DimensionSpec getDelegate()
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:Cacheable
Get a byte array used as a cache key.- Specified by:
getCacheKey
in interfaceCacheable
- Returns:
- a cache key
-
makeDimensionSelector
public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory)
Description copied from interface:VirtualColumn
Build a selector corresponding to this virtual column. Also provides the name that the virtual column was referenced with (throughDimensionSpec.getDimension()
, which is useful if this column uses dot notation. The virtual column is expected to apply any necessary decoration from the dimensionSpec.- Specified by:
makeDimensionSelector
in interfaceVirtualColumn
-
makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelectorFactory factory)
Description copied from interface:VirtualColumn
Build aColumnValueSelector
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.- Specified by:
makeColumnValueSelector
in interfaceVirtualColumn
-
capabilities
public ColumnCapabilities capabilities(String columnName)
Description copied from interface:VirtualColumn
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. 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:
capabilities
in interfaceVirtualColumn
- Parameters:
columnName
- the name this virtual column was referenced with- Returns:
- capabilities, must not be null
-
capabilities
@Nullable public ColumnCapabilities capabilities(ColumnInspector inspector, String columnName)
Description copied from interface:VirtualColumn
Return theColumnCapabilities
which best describe the optimal selector to read from this virtual column.The
ColumnInspector
(most likely corresponding to an underlyingColumnSelectorFactory
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 theColumnInspector
to infer the output type of expressions based on the types of the inputs.- Specified by:
capabilities
in interfaceVirtualColumn
- Parameters:
inspector
- column inspector to provide additional information of other available columnscolumnName
- the name this virtual column was referenced with- Returns:
- capabilities, must not be null
-
requiredColumns
public List<String> requiredColumns()
Description copied from interface:VirtualColumn
Returns 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:
requiredColumns
in interfaceVirtualColumn
- Returns:
- column names
-
usesDotNotation
public boolean usesDotNotation()
Description copied from interface:VirtualColumn
Indicates 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:
usesDotNotation
in interfaceVirtualColumn
- Returns:
- whether to use dot notation
-
getIndexSupplier
@Nullable public ColumnIndexSupplier getIndexSupplier(String columnName, ColumnSelector columnSelector)
Description copied from interface:VirtualColumn
Get theColumnIndexSupplier
for the specified virtual column, with the assistance of aColumnSelector
to allow reading things from segments. If the virtual column has no indexes, this method will return null, or may also return a non-null supplier whose methods may return null values - having a supplier is no guarantee that the column has indexes.- Specified by:
getIndexSupplier
in interfaceVirtualColumn
-
-