Package org.apache.druid.math.expr
Class ExprMacroTable
- java.lang.Object
-
- org.apache.druid.math.expr.ExprMacroTable
-
- Direct Known Subclasses:
GuiceExprMacroTable
public class ExprMacroTable extends Object
Mechanism by which Druid expressions can define new functions for the Druid expression language. WhenExprListenerImpl
is creating aFunctionExpr
,ExprMacroTable
will first be checked to find the function by name, falling back toParser.getFunction(String)
to map to a built-inFunction
if none is defined in the macro table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExprMacroTable.BaseScalarMacroFunctionExpr
Base class for multi-argumentExprMacroTable.ExprMacro
functionExpr
static class
ExprMacroTable.BaseScalarUnivariateMacroFunctionExpr
Base class for single argumentExprMacroTable.ExprMacro
functionExpr
static interface
ExprMacroTable.ExprMacro
static interface
ExprMacroTable.ExprMacroFunctionExpr
stub interface to allowParser.flatten(Expr)
a way to recognize macro functions that exend this
-
Constructor Summary
Constructors Constructor Description ExprMacroTable(List<ExprMacroTable.ExprMacro> macros)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Expr
get(String functionName, List<Expr> args)
Returns an expr corresponding to a function call if this table has an entry forfunctionName
.List<ExprMacroTable.ExprMacro>
getMacros()
static ExprMacroTable
nil()
-
-
-
Constructor Detail
-
ExprMacroTable
public ExprMacroTable(List<ExprMacroTable.ExprMacro> macros)
-
-
Method Detail
-
nil
public static ExprMacroTable nil()
-
getMacros
public List<ExprMacroTable.ExprMacro> getMacros()
-
get
@Nullable public Expr get(String functionName, List<Expr> args)
Returns an expr corresponding to a function call if this table has an entry forfunctionName
. Otherwise, returns null.- Parameters:
functionName
- function nameargs
- function arguments- Returns:
- expr for this function call, or null
-
-