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
AColumnSelectorFactorythat is based on an object supplier and aRowAdapterfor that type of object.
-
-
Constructor Summary
Constructors Constructor Description RowBasedColumnSelectorFactory(Supplier<T> rowSupplier, RowIdSupplier rowIdSupplier, RowAdapter<T> adapter, ColumnInspector columnInspector, boolean throwParseExceptions, boolean useStringValueOfNullInLists)Full constructor forRowBasedCursor.
-
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 aRowAdapterfor that object.ColumnCapabilitiesgetColumnCapabilities(String columnName)Returns capabilities of a particular column, if known.RowIdSuppliergetRowIdSupplier()Returns aRowIdSupplierthat 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, orNilColumnValueSelectorif the column with such name is absent.DimensionSelectormakeDimensionSelector(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
getType
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
-
-
-
Constructor Detail
-
RowBasedColumnSelectorFactory
public RowBasedColumnSelectorFactory(Supplier<T> rowSupplier, @Nullable RowIdSupplier rowIdSupplier, RowAdapter<T> adapter, ColumnInspector columnInspector, boolean throwParseExceptions, boolean useStringValueOfNullInLists)
Full constructor forRowBasedCursor. Allows passing in a rowIdSupplier, which enables column value reuse optimizations.
-
-
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 aRowAdapterfor 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:
makeDimensionSelectorin interfaceColumnSelectorFactory
-
makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(String columnName)
Description copied from interface:ColumnSelectorFactoryReturns ColumnValueSelector corresponding to the given column name, orNilColumnValueSelectorif the column with such name is absent.- Specified by:
makeColumnValueSelectorin interfaceColumnSelectorFactory
-
getRowIdSupplier
@Nullable public RowIdSupplier getRowIdSupplier()
Description copied from interface:ColumnSelectorFactoryReturns aRowIdSupplierthat 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:
getRowIdSupplierin interfaceColumnSelectorFactory
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String columnName)
Description copied from interface:ColumnSelectorFactoryReturns 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:
getColumnCapabilitiesin interfaceColumnInspector- Specified by:
getColumnCapabilitiesin interfaceColumnSelectorFactory- Parameters:
columnName- column name- Returns:
- capabilities, or null
-
-