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. WhenExprListenerImplis creating aFunctionExpr,ExprMacroTablewill first be checked to find the function by name, falling back toParser.getFunction(String)to map to a built-inFunctionif none is defined in the macro table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExprMacroTable.BaseMacroFunctionExprBase class forExprfromExprMacroTable.ExprMacro.static classExprMacroTable.BaseScalarMacroFunctionExprBase class forExprfromExprMacroTable.ExprMacrothat accepts all-scalar arguments.static interfaceExprMacroTable.ExprMacrostatic interfaceExprMacroTable.ExprMacroFunctionExprstub 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 Exprget(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 ExprMacroTablegranularity()SpecializedExprMacroTablethat only knows aboutTimestampFloorExprMacro, intended for use parsing generated expressions which translateGranularityintoExprstatic ExprMacroTablenil()
-
-
-
Constructor Detail
-
ExprMacroTable
public ExprMacroTable(List<ExprMacroTable.ExprMacro> macros)
-
-
Method Detail
-
nil
public static ExprMacroTable nil()
-
granularity
public static ExprMacroTable granularity()
SpecializedExprMacroTablethat only knows aboutTimestampFloorExprMacro, intended for use parsing generated expressions which translateGranularityintoExpr
-
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
-
-