Package org.apache.druid.segment
Class RowBasedColumnSelectorFactory<T>
java.lang.Object
org.apache.druid.segment.RowBasedColumnSelectorFactory<T>
- All Implemented Interfaces:
Expr.InputBindingInspector,ColumnInspector,ColumnSelectorFactory
A
ColumnSelectorFactory that is based on an object supplier and a RowAdapter for that type of object.-
Constructor Summary
ConstructorsConstructorDescriptionRowBasedColumnSelectorFactory(Supplier<T> rowSupplier, RowIdSupplier rowIdSupplier, RowAdapter<T> adapter, ColumnInspector columnInspector, boolean throwParseExceptions, boolean useStringValueOfNullInLists) Full constructor forRowBasedCursor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.getColumnCapabilities(String columnName) Returns capabilities of a particular column, if known.Returns aRowIdSupplierthat allows callers to detect whether the selectors returned by this factory have moved or not.makeColumnValueSelector(String columnName) Returns ColumnValueSelector corresponding to the given column name, orNilColumnValueSelectorif the column with such name is absent.makeDimensionSelector(DimensionSpec dimensionSpec) 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.ColumnInspector
getTypeMethods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
Constructor Details
-
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 Details
-
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
- Specified by:
makeDimensionSelectorin interfaceColumnSelectorFactory
-
makeColumnValueSelector
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
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
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
-