Package org.apache.druid.math.expr
Class ExprMacroTable.BaseMacroFunctionExpr
- java.lang.Object
-
- org.apache.druid.math.expr.ExprMacroTable.BaseMacroFunctionExpr
-
- All Implemented Interfaces:
Cacheable,Expr,ExprMacroTable.ExprMacroFunctionExpr
- Direct Known Subclasses:
ExprMacroTable.BaseScalarMacroFunctionExpr
- Enclosing class:
- ExprMacroTable
public abstract static class ExprMacroTable.BaseMacroFunctionExpr extends Object implements ExprMacroTable.ExprMacroFunctionExpr
Base class forExprfromExprMacroTable.ExprMacro.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.math.expr.Expr
Expr.BindingAnalysis, Expr.InputBindingInspector, Expr.ObjectBinding, Expr.Shuttle, Expr.VectorInputBinding, Expr.VectorInputBindingInspector
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Expr>argsprotected ExprMacroTable.ExprMacromacro-
Fields inherited from interface org.apache.druid.math.expr.Expr
ARG_JOINER, NULL_LITERAL
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseMacroFunctionExpr(ExprMacroTable.ExprMacro macro, List<Expr> macroArgs)Constructor for subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Expr.BindingAnalysisanalyzeInputs()<T> ExprVectorProcessor<T>asVectorProcessor(Expr.VectorInputBindingInspector inspector)Builds a 'vectorized' expression processor, that can operate on batches of input values for use in vectorized query engines.booleancanVectorize(Expr.InputBindingInspector inspector)Check if an expression can be 'vectorized', for a given set of inputs.booleanequals(Object o)List<Expr>getArgs()inthashCode()Stringstringify()Convert theExprback into parseable string that when parsed withParser.parse(String, ExprMacroTable)will produce an equivalentExpr.protected abstract Expr.BindingAnalysissupplyAnalyzeInputs()Implemented by subclasses to provide the value foranalyzeInputs(), which uses a memoized supplier.StringtoString()Exprvisit(Expr.Shuttle shuttle)Programatically rewrite theExprtree with aExpr.Shuttle.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.math.expr.Expr
asColumnIndexSupplier, asSingleThreaded, canFallbackVectorize, decorateCacheKeyBuilder, eval, getBindingIfIdentifier, getCacheKey, getIdentifierExprIfIdentifierExpr, getIdentifierIfIdentifier, getLiteralValue, getOutputType, isIdentifier, isLiteral, isNullLiteral
-
-
-
-
Field Detail
-
macro
protected final ExprMacroTable.ExprMacro macro
-
-
Constructor Detail
-
BaseMacroFunctionExpr
protected BaseMacroFunctionExpr(ExprMacroTable.ExprMacro macro, List<Expr> macroArgs)
Constructor for subclasses.- Parameters:
macro- macro that created this exprmacroArgs- original args to the macro (not the ones this will be evaled with)
-
-
Method Detail
-
getArgs
public List<Expr> getArgs()
- Specified by:
getArgsin interfaceExprMacroTable.ExprMacroFunctionExpr
-
stringify
public String stringify()
Description copied from interface:ExprConvert theExprback into parseable string that when parsed withParser.parse(String, ExprMacroTable)will produce an equivalentExpr.
-
visit
public Expr visit(Expr.Shuttle shuttle)
Description copied from interface:ExprProgramatically rewrite theExprtree with aExpr.Shuttle. EachExpris responsible for ensuring theExpr.Shuttlecan visit all of itsExprchildren, as well as updating its childrenExprwith the results from theExpr.Shuttle, before finally visiting an updated form of itself. When this Expr is the result ofExprMacroTable.ExprMacro.apply(java.util.List<org.apache.druid.math.expr.Expr>), all of the original arguments to the macro must be visited, including arguments that may have been "baked in" to this Expr.
-
analyzeInputs
public Expr.BindingAnalysis analyzeInputs()
Description copied from interface:Expr- Specified by:
analyzeInputsin interfaceExpr
-
canVectorize
public boolean canVectorize(Expr.InputBindingInspector inspector)
Description copied from interface:ExprCheck if an expression can be 'vectorized', for a given set of inputs. If this method returns true,Expr.asVectorProcessor(org.apache.druid.math.expr.Expr.VectorInputBindingInspector)is expected to produce aExprVectorProcessorwhich can evaluate values in batches to use with vectorized query engines.- Specified by:
canVectorizein interfaceExpr
-
asVectorProcessor
public <T> ExprVectorProcessor<T> asVectorProcessor(Expr.VectorInputBindingInspector inspector)
Description copied from interface:ExprBuilds a 'vectorized' expression processor, that can operate on batches of input values for use in vectorized query engines.- Specified by:
asVectorProcessorin interfaceExpr
-
supplyAnalyzeInputs
protected abstract Expr.BindingAnalysis supplyAnalyzeInputs()
Implemented by subclasses to provide the value foranalyzeInputs(), which uses a memoized supplier.
-
-