public class ExpressionSelectors extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canMapOverDictionary(Expr.BindingAnalysis bindingAnalysis,
ColumnCapabilities columnCapabilities)
Returns whether an expression can be applied to unique values of a particular column (like those in a dictionary)
rather than being applied to each row individually.
|
static Object |
coerceEvalToObjectOrList(ExprEval eval)
Coerces
ExprEval value back to a ColumnType.STRING selector friendly value, converting into:
- the expression value if the value is not an array
- the single array element if the value is an array with 1 element
- a list with all of the array elements if the value is an array with more than 1 element
This method is used by makeStringColumnValueSelector(ColumnSelectorFactory, Expr), which is used
exclusively for making ColumnValueSelector when an ExpressionVirtualColumn has STRING output type,
and by ExpressionTransform which should be reconsidered if we ever
want to add support for ingestion transforms producing ValueType.ARRAY typed outputs. |
static Expr.ObjectBinding |
createBindings(ColumnSelectorFactory columnSelectorFactory,
ExpressionPlan plan)
Create
Expr.ObjectBinding given a ColumnSelectorFactory and ExpressionPlan which
provides the set of identifiers which need a binding (list of required columns), and context of whether or not they
are used as array or scalar inputs |
static ColumnValueSelector |
makeColumnValueSelector(ColumnSelectorFactory columnSelectorFactory,
Expr expression)
Makes a ColumnValueSelector whose getObject method returns an Object that is the value computed by
an
ExprEval. |
static DimensionSelector |
makeDimensionSelector(ColumnSelectorFactory columnSelectorFactory,
Expr expression,
ExtractionFn extractionFn)
Makes a single or multi-value
DimensionSelector wrapper around a ColumnValueSelector created by
makeExprEvalSelector(ColumnSelectorFactory, Expr) as appropriate |
static ColumnValueSelector<ExprEval> |
makeExprEvalSelector(ColumnSelectorFactory columnSelectorFactory,
Expr expression)
Makes a ColumnValueSelector whose getObject method returns an
ExprEval. |
static ColumnValueSelector<ExprEval> |
makeExprEvalSelector(ColumnSelectorFactory columnSelectorFactory,
ExpressionPlan plan) |
static <T> com.google.common.base.Supplier<T> |
makeNullableNumericSupplier(ColumnValueSelector selector,
com.google.common.base.Supplier<T> supplier)
Wraps a
ColumnValueSelector and uses it to supply numeric values in a null-aware way. |
static ColumnValueSelector |
makeStringColumnValueSelector(ColumnSelectorFactory columnSelectorFactory,
Expr expression) |
public static ColumnValueSelector makeColumnValueSelector(ColumnSelectorFactory columnSelectorFactory, Expr expression)
ExprEval.public static ColumnValueSelector makeStringColumnValueSelector(ColumnSelectorFactory columnSelectorFactory, Expr expression)
public static ColumnValueSelector<ExprEval> makeExprEvalSelector(ColumnSelectorFactory columnSelectorFactory, Expr expression)
ExprEval.public static ColumnValueSelector<ExprEval> makeExprEvalSelector(ColumnSelectorFactory columnSelectorFactory, ExpressionPlan plan)
public static DimensionSelector makeDimensionSelector(ColumnSelectorFactory columnSelectorFactory, Expr expression, @Nullable ExtractionFn extractionFn)
DimensionSelector wrapper around a ColumnValueSelector created by
makeExprEvalSelector(ColumnSelectorFactory, Expr) as appropriatepublic static boolean canMapOverDictionary(Expr.BindingAnalysis bindingAnalysis, ColumnCapabilities columnCapabilities)
bindingAnalysis - result of calling Expr.analyzeInputs() on an expressioncolumnCapabilities - ColumnCapabilities for the input bindingpublic static Expr.ObjectBinding createBindings(ColumnSelectorFactory columnSelectorFactory, ExpressionPlan plan)
Expr.ObjectBinding given a ColumnSelectorFactory and ExpressionPlan which
provides the set of identifiers which need a binding (list of required columns), and context of whether or not they
are used as array or scalar inputspublic static <T> com.google.common.base.Supplier<T> makeNullableNumericSupplier(ColumnValueSelector selector, com.google.common.base.Supplier<T> supplier)
ColumnValueSelector and uses it to supply numeric values in a null-aware way.@Nullable public static Object coerceEvalToObjectOrList(ExprEval eval)
ExprEval value back to a ColumnType.STRING selector friendly value, converting into:
- the expression value if the value is not an array
- the single array element if the value is an array with 1 element
- a list with all of the array elements if the value is an array with more than 1 element
This method is used by makeStringColumnValueSelector(ColumnSelectorFactory, Expr), which is used
exclusively for making ColumnValueSelector when an ExpressionVirtualColumn has STRING output type,
and by ExpressionTransform which should be reconsidered if we ever
want to add support for ingestion transforms producing ValueType.ARRAY typed outputs.Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.