Package org.apache.druid.math.expr
Class InputBindings
- java.lang.Object
-
- org.apache.druid.math.expr.InputBindings
-
public class InputBindings extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInputBindings.BestEffortInputBindingsExpr.ObjectBindingbacked by a cache populated byExprEval.bestEffortOf(Object)for when the input type information is totally unknown, for a single row worth of values.static classInputBindings.InputSupplier<T>
-
Constructor Summary
Constructors Constructor Description InputBindings()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Expr.ObjectBindingforInputSupplier(String supplierName, ExpressionType type, com.google.common.base.Supplier<?> supplier)Create aExpr.ObjectBindingfor a single input value of a known type provided by someSupplierstatic Expr.ObjectBindingforInputSupplier(ExpressionType type, com.google.common.base.Supplier<?> supplier)Create aExpr.ObjectBindingfor a single input value of a known type provided by someSupplierstatic Expr.ObjectBindingforInputSuppliers(Map<String,InputBindings.InputSupplier<?>> bindings)CreateExpr.ObjectBindingbacked by map ofSupplierto provide values for identifiers to evaluateExprstatic Expr.ObjectBindingforMap(Map<String,?> bindings)Deprecated.static Expr.ObjectBindingforMap(Map<String,?> bindings, Expr.InputBindingInspector inspector)CreateExpr.ObjectBindingbacked byMapto provide values for identifiers to evaluateExprTypes are detected and values are coereced viaExprEval.bestEffortOf(Object)because input types are currently unknown.static Expr.ObjectBindingforRow(Row row)Creates aExpr.ObjectBindingbacked by someRow.static <T> InputBindings.InputSupplier<T>inputSupplier(ExpressionType type, com.google.common.base.Supplier<T> supplier)static Expr.InputBindingInspectorinspectorFromTypeMap(Map<String,ExpressionType> types)Create anExpr.InputBindingInspectorbacked by a map of binding identifiers to theirExprTypestatic Expr.ObjectBindingnilBindings()EmptyExpr.ObjectBindingthat doesn't complain about attempts to access type or value for any input identifiers, both of which will be nulls.static Expr.ObjectBindingvalidateConstant(Expr expr)Empty binding that throw aUOEif anything attempts to lookup an identifier type or value
-
-
-
Method Detail
-
nilBindings
public static Expr.ObjectBinding nilBindings()
EmptyExpr.ObjectBindingthat doesn't complain about attempts to access type or value for any input identifiers, both of which will be nulls. Typically used for evaluating known constant expressions, or finding a default or initial value of some expression if all inputs are null.
-
validateConstant
public static Expr.ObjectBinding validateConstant(Expr expr)
Empty binding that throw aUOEif anything attempts to lookup an identifier type or value
-
inspectorFromTypeMap
public static Expr.InputBindingInspector inspectorFromTypeMap(Map<String,ExpressionType> types)
Create anExpr.InputBindingInspectorbacked by a map of binding identifiers to theirExprType
-
forRow
public static Expr.ObjectBinding forRow(Row row)
Creates aExpr.ObjectBindingbacked by someRow.ColumnHolder.TIME_COLUMN_NAMEis special handled to be backed byRow.getTimestampFromEpoch(), all other values are ethically sourced fromRow.getRaw(String). Types are detected and values are coereced viaExprEval.bestEffortOf(Object)because input types are currently unknown.
-
forMap
@Deprecated public static Expr.ObjectBinding forMap(Map<String,?> bindings)
Deprecated.CreateExpr.ObjectBindingbacked byMapto provide values for identifiers to evaluateExprTypes are detected and values are coereced viaExprEval.bestEffortOf(Object)because input types are currently unknown. This method is only used for testing and mimics the behavior offorRow(Row)except lacks special handling for columns namedColumnHolder.TIME_COLUMN_NAME.
-
forMap
public static Expr.ObjectBinding forMap(Map<String,?> bindings, Expr.InputBindingInspector inspector)
CreateExpr.ObjectBindingbacked byMapto provide values for identifiers to evaluateExprTypes are detected and values are coereced viaExprEval.bestEffortOf(Object)because input types are currently unknown.
-
forInputSupplier
public static Expr.ObjectBinding forInputSupplier(ExpressionType type, com.google.common.base.Supplier<?> supplier)
Create aExpr.ObjectBindingfor a single input value of a known type provided by someSupplier
-
forInputSupplier
public static Expr.ObjectBinding forInputSupplier(String supplierName, ExpressionType type, com.google.common.base.Supplier<?> supplier)
Create aExpr.ObjectBindingfor a single input value of a known type provided by someSupplier
-
inputSupplier
public static <T> InputBindings.InputSupplier<T> inputSupplier(ExpressionType type, com.google.common.base.Supplier<T> supplier)
-
forInputSuppliers
public static Expr.ObjectBinding forInputSuppliers(Map<String,InputBindings.InputSupplier<?>> bindings)
CreateExpr.ObjectBindingbacked by map ofSupplierto provide values for identifiers to evaluateExpr
-
-