Package org.apache.druid.segment
Class RowBasedColumnSelectorFactory<T>
- java.lang.Object
-
- org.apache.druid.segment.RowBasedColumnSelectorFactory<T>
-
- All Implemented Interfaces:
Expr.InputBindingInspector
,ColumnInspector
,ColumnSelectorFactory
public class RowBasedColumnSelectorFactory<T> extends Object implements ColumnSelectorFactory
AColumnSelectorFactory
that is based on an object supplier and aRowAdapter
for that type of object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <RowType> RowBasedColumnSelectorFactory<RowType>
create(RowAdapter<RowType> adapter, Supplier<RowType> supplier, ColumnInspector columnInspector, boolean throwParseExceptions, boolean useStringValueOfNullInLists)
Create an instance based on any object, along with aRowAdapter
for that object.ColumnCapabilities
getColumnCapabilities(String columnName)
Returns capabilities of a particular column, if known.RowIdSupplier
getRowIdSupplier()
Returns aRowIdSupplier
that allows callers to detect whether the selectors returned by this factory have moved or not.ColumnValueSelector<?>
makeColumnValueSelector(String columnName)
Returns ColumnValueSelector corresponding to the given column name, orNilColumnValueSelector
if the column with such name is absent.DimensionSelector
makeDimensionSelector(DimensionSpec dimensionSpec)
-
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.ColumnInspector
getColumnCapabilitiesWithDefault, getType
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
-
-
-
Method Detail
-
create
public static <RowType> RowBasedColumnSelectorFactory<RowType> create(RowAdapter<RowType> adapter, Supplier<RowType> supplier, ColumnInspector columnInspector, boolean throwParseExceptions, boolean useStringValueOfNullInLists)
Create an instance based on any object, along with aRowAdapter
for that object.- Parameters:
adapter
- adapter for these row objectssupplier
- supplier of row objectscolumnInspector
- will be used for reporting available columns and their capabilities. Note that this factory will still allow creation of selectors on any named field in the rows, even if it doesn't appear in "columnInspector". (It only needs to be accessible viaRowAdapter.columnFunction(java.lang.String)
.) As a result, you can achieve an untyped mode by passing inRowSignature.empty()
.throwParseExceptions
- whether numeric selectors should throw parse exceptions or use a default/null value when their inputs are not actually numericuseStringValueOfNullInLists
- whether nulls in multi-value strings should be replaced with the string "null". for example: the list ["a", null] would be converted to ["a", "null"]. Useful for callers that need compatibility withRows.objectToStrings(java.lang.Object)
.
-
makeDimensionSelector
public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec)
- Specified by:
makeDimensionSelector
in interfaceColumnSelectorFactory
-
makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(String columnName)
Description copied from interface:ColumnSelectorFactory
Returns ColumnValueSelector corresponding to the given column name, orNilColumnValueSelector
if the column with such name is absent.- Specified by:
makeColumnValueSelector
in interfaceColumnSelectorFactory
-
getRowIdSupplier
@Nullable public RowIdSupplier getRowIdSupplier()
Description copied from interface:ColumnSelectorFactory
Returns aRowIdSupplier
that allows callers to detect whether the selectors returned by this factory have moved or not. Useful for selectors that wrap other selectors, such as virtual columns, as it allows them to cache their outputs.- Specified by:
getRowIdSupplier
in interfaceColumnSelectorFactory
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String columnName)
Description copied from interface:ColumnSelectorFactory
Returns capabilities of a particular column, if known. May be null if the column doesn't exist, or if the column does exist but the capabilities are unknown. The latter is possible with dynamically discovered columns.- Specified by:
getColumnCapabilities
in interfaceColumnInspector
- Specified by:
getColumnCapabilities
in interfaceColumnSelectorFactory
- Parameters:
columnName
- column name- Returns:
- capabilities, or null
-
-