Package org.apache.druid.math.expr
Interface Function
-
- All Superinterfaces:
NamedFunction
- All Known Implementing Classes:
Function.Abs,Function.Acos,Function.ArrayAddElementFunction,Function.ArrayAppendFunction,Function.ArrayConcatFunction,Function.ArrayConstructorFunction,Function.ArrayContainsFunction,Function.ArrayLengthFunction,Function.ArrayOffsetFunction,Function.ArrayOffsetOfFunction,Function.ArrayOrdinalFunction,Function.ArrayOrdinalOfFunction,Function.ArrayOverlapFunction,Function.ArrayPrependFunction,Function.ArrayScalarFunction,Function.ArraySetAddAllFunction,Function.ArraySetAddFunction,Function.ArraysFunction,Function.ArraySliceFunction,Function.ArraysMergeFunction,Function.ArrayToMultiValueStringFunction,Function.ArrayToStringFunction,Function.Asin,Function.Atan,Function.Atan2,Function.BitwiseAnd,Function.BitwiseComplement,Function.BitwiseConvertDoubleToLongBits,Function.BitwiseConvertLongBitsToDouble,Function.BitwiseOr,Function.BitwiseShiftLeft,Function.BitwiseShiftRight,Function.BitwiseXor,Function.BivariateBitwiseMathFunction,Function.BivariateFunction,Function.BivariateMathFunction,Function.CaseSearchedFunc,Function.CaseSimpleFunc,Function.CastFunc,Function.Cbrt,Function.Ceil,Function.CoalesceFunc,Function.ConcatFunc,Function.ConditionFunc,Function.CopySign,Function.Cos,Function.Cosh,Function.Cot,Function.Div,Function.DoubleBivariateMathFunction,Function.DoubleUnivariateMathFunction,Function.Exp,Function.Expm1,Function.Floor,Function.GetExponent,Function.GreatestFunc,Function.HumanReadableBinaryByteFormatFunc,Function.HumanReadableDecimalByteFormatFunc,Function.HumanReadableDecimalFormatFunc,Function.Hypot,Function.IsDistinctFromFunc,Function.IsFalseFunc,Function.IsNotDistinctFromFunc,Function.IsNotFalseFunc,Function.IsNotNullFunc,Function.IsNotTrueFunc,Function.IsNullFunc,Function.IsTrueFunc,Function.LeastFunc,Function.LeftFunc,Function.Log,Function.Log10,Function.Log1p,Function.LowerFunc,Function.LpadFunc,Function.Max,Function.Min,Function.MultiValueStringHarmonizeNullsFunction,Function.MultiValueStringToArrayFunction,Function.NextAfter,Function.NextUp,Function.NvlFunc,Function.ParseLong,Function.Pi,Function.Pow,Function.ReduceFunction,Function.Remainder,Function.RepeatFunc,Function.ReplaceFunc,Function.ReverseFunc,Function.RightFunc,Function.Rint,Function.Round,Function.RpadFunc,Function.SafeDivide,Function.ScalarInArrayFunction,Function.Scalb,Function.Signum,Function.Sin,Function.Sinh,Function.SizeFormatFunc,Function.Sqrt,Function.StringFormatFunc,Function.StringLongFunction,Function.StringToArrayFunction,Function.StrlenFunc,Function.StrposFunc,Function.SubMonthFunc,Function.SubstringFunc,Function.Tan,Function.Tanh,Function.TimestampFromEpochFunc,Function.ToDegrees,Function.ToRadians,Function.Ulp,Function.UnivariateFunction,Function.UnivariateMathFunction,Function.UnixTimestampFunc,Function.UpperFunc
public interface Function extends NamedFunction
Base interface describing the mechanism used to evaluate aFunctionExpr. AllFunctionimplementations are immutable. Do NOT remove "unused" members in this class. They are used by generated Antlr
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classFunction.Absstatic classFunction.Acosstatic classFunction.ArrayAddElementFunctionScaffolding for a 2 argumentFunctionwhich accepts one array and one scalar input and adds the scalar input to the array in some way.static classFunction.ArrayAppendFunctionstatic classFunction.ArrayConcatFunctionstatic classFunction.ArrayConstructorFunctionstatic classFunction.ArrayContainsFunctionstatic classFunction.ArrayLengthFunctionstatic classFunction.ArrayOffsetFunctionstatic classFunction.ArrayOffsetOfFunctionstatic classFunction.ArrayOrdinalFunctionstatic classFunction.ArrayOrdinalOfFunctionstatic classFunction.ArrayOverlapFunctionstatic classFunction.ArrayPrependFunctionstatic classFunction.ArrayScalarFunctionFunctionthat takes 1 array operand and 1 scalar operandstatic classFunction.ArraySetAddAllFunctionstatic classFunction.ArraySetAddFunctionstatic classFunction.ArraysFunctionFunctionthat takes 2 array operandsstatic classFunction.ArraySliceFunctionstatic classFunction.ArraysMergeFunctionBase scaffolding for functions which accept 2 array arguments and combine them in some waystatic classFunction.ArrayToMultiValueStringFunctionstatic classFunction.ArrayToStringFunctionstatic classFunction.Asinstatic classFunction.Atanstatic classFunction.Atan2static classFunction.BitwiseAndstatic classFunction.BitwiseComplementstatic classFunction.BitwiseConvertDoubleToLongBitsstatic classFunction.BitwiseConvertLongBitsToDoublestatic classFunction.BitwiseOrstatic classFunction.BitwiseShiftLeftstatic classFunction.BitwiseShiftRightstatic classFunction.BitwiseXorstatic classFunction.BivariateBitwiseMathFunctionstatic classFunction.BivariateFunctionBase class for a 2 variable inputFunctionimplementationstatic classFunction.BivariateMathFunctionBase class for a 2 variable input mathematicalFunction, with specialized 'eval' implementations that operate on primitive number typesstatic classFunction.CaseSearchedFunc"Searched CASE" function, similar toCASE WHEN boolean_expr THEN result [ELSE else_result] ENDin SQL.static classFunction.CaseSimpleFunc"Simple CASE" function, similar toCASE expr WHEN value THEN result [ELSE else_result] ENDin SQL.static classFunction.CastFuncstatic classFunction.Cbrtstatic classFunction.Ceilstatic classFunction.CoalesceFuncstatic classFunction.ConcatFuncstatic classFunction.ConditionFuncstatic classFunction.CopySignstatic classFunction.Cosstatic classFunction.Coshstatic classFunction.Cotstatic classFunction.Divstatic classFunction.DoubleBivariateMathFunctionMany math functions always output aDoubleprimitive, regardless of input type.static classFunction.DoubleUnivariateMathFunctionMany math functions always output aDoubleprimitive, regardless of input type.static classFunction.Expstatic classFunction.Expm1static classFunction.Floorstatic classFunction.GetExponentstatic classFunction.GreatestFuncstatic classFunction.HumanReadableBinaryByteFormatFuncstatic classFunction.HumanReadableDecimalByteFormatFuncstatic classFunction.HumanReadableDecimalFormatFuncstatic classFunction.Hypotstatic classFunction.IsDistinctFromFuncSQL function "x IS DISTINCT FROM y".static classFunction.IsFalseFuncSQL function "IS FALSE".static classFunction.IsNotDistinctFromFuncSQL function "x IS NOT DISTINCT FROM y".static classFunction.IsNotFalseFuncSQL function "IS NOT FALSE".static classFunction.IsNotNullFuncstatic classFunction.IsNotTrueFuncSQL function "IS NOT TRUE".static classFunction.IsNullFuncstatic classFunction.IsTrueFuncSQL function "IS TRUE".static classFunction.LeastFuncstatic classFunction.LeftFuncstatic classFunction.Logstatic classFunction.Log10static classFunction.Log1pstatic classFunction.LowerFuncstatic classFunction.LpadFuncstatic classFunction.Maxstatic classFunction.Minstatic classFunction.MultiValueStringHarmonizeNullsFunctionPrimarily internal helper function used to coerce null, [], and [null] into [null], similar to the logic done byExpressionSelectors.supplierFromDimensionSelector(org.apache.druid.segment.DimensionSelector, boolean, boolean)when the 3rd argument is true, which is done when implicitly mapping scalar functions over mvd values.static classFunction.MultiValueStringToArrayFunctionstatic classFunction.NextAfterstatic classFunction.NextUpstatic classFunction.NvlFuncnvl is like coalesce, but accepts exactly two arguments.static classFunction.ParseLongstatic classFunction.Pistatic classFunction.Powstatic classFunction.ReduceFunctionstatic classFunction.Remainderstatic classFunction.RepeatFuncstatic classFunction.ReplaceFuncstatic classFunction.ReverseFuncstatic classFunction.RightFuncstatic classFunction.Rintstatic classFunction.Roundstatic classFunction.RpadFuncstatic classFunction.SafeDividestatic classFunction.ScalarInArrayFunctionstatic classFunction.Scalbstatic classFunction.Signumstatic classFunction.Sinstatic classFunction.Sinhstatic classFunction.SizeFormatFuncstatic classFunction.Sqrtstatic classFunction.StringFormatFuncstatic classFunction.StringLongFunctionBase class for a 2 variable inputFunctionwhose first argument is aExprType.STRINGand second argument isExprType.LONG.static classFunction.StringToArrayFunctionstatic classFunction.StrlenFuncstatic classFunction.StrposFuncstatic classFunction.SubMonthFuncstatic classFunction.SubstringFuncstatic classFunction.Tanstatic classFunction.Tanhstatic classFunction.TimestampFromEpochFuncstatic classFunction.ToDegreesstatic classFunction.ToRadiansstatic classFunction.Ulpstatic classFunction.UnivariateFunctionBase class for a single variable inputFunctionimplementationstatic classFunction.UnivariateMathFunctionBase class for a single variable input mathematicalFunction, with specialized 'eval' implementations that that operate on primitive number typesstatic classFunction.UnixTimestampFuncstatic classFunction.UpperFunc
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ExprEvalapply(List<Expr> args, Expr.ObjectBinding bindings)Evaluate the function, given a list of arguments and a set of bindings to provide values forIdentifierExpr.default FunctionasSingleThreaded(List<Expr> args, Expr.InputBindingInspector inspector)default <T> ExprVectorProcessor<T>asVectorProcessor(Expr.VectorInputBindingInspector inspector, List<Expr> args)Builds a 'vectorized' function expression processor, that can build vectorized processors for its input values usingExpr.asVectorProcessor(org.apache.druid.math.expr.Expr.VectorInputBindingInspector), for use in vectorized query engines.default booleancanVectorize(Expr.InputBindingInspector inspector, List<Expr> args)Check if a function can be 'vectorized', for a given set ofExprinputs.default Set<Expr>getArrayInputs(List<Expr> args)Given a list of arguments to thisFunction, get the set of arguments that must evaluate to an array valueExpressionTypegetOutputType(Expr.InputBindingInspector inspector, List<Expr> args)Compute the output type of this function for a given set of argument expression inputs.default Set<Expr>getScalarInputs(List<Expr> args)Given a list of arguments to thisFunction, get the set of arguments that must evaluate to a scalar valuedefault booleanhasArrayInputs()Returns true if a function expects any array argumentsdefault booleanhasArrayOutput()Returns true if function produces an array.voidvalidateArguments(List<Expr> args)Validate function arguments.-
Methods inherited from interface org.apache.druid.math.expr.NamedFunction
name, processingFailed, validationFailed, validationFailed, validationHelperCheckAnyOfArgumentCount, validationHelperCheckArgIsLiteral, validationHelperCheckArgumentCount, validationHelperCheckArgumentCount, validationHelperCheckArgumentRange, validationHelperCheckLambaArgumentCount, validationHelperCheckMinArgumentCount, validationHelperCheckMinArgumentCount
-
-
-
-
Method Detail
-
asSingleThreaded
default Function asSingleThreaded(List<Expr> args, Expr.InputBindingInspector inspector)
-
apply
ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings)
Evaluate the function, given a list of arguments and a set of bindings to provide values forIdentifierExpr.
-
getScalarInputs
default Set<Expr> getScalarInputs(List<Expr> args)
Given a list of arguments to thisFunction, get the set of arguments that must evaluate to a scalar value
-
getArrayInputs
default Set<Expr> getArrayInputs(List<Expr> args)
Given a list of arguments to thisFunction, get the set of arguments that must evaluate to an array value
-
hasArrayInputs
default boolean hasArrayInputs()
Returns true if a function expects any array arguments
-
hasArrayOutput
default boolean hasArrayOutput()
Returns true if function produces an array. AllFunctionimplementations are expected to exclusively produce either scalar or array values.
-
validateArguments
void validateArguments(List<Expr> args)
Validate function arguments. This method is called whenever aFunctionExpris created, and should validate everything that is feasible up front. Note that input type information is typically unavailable at the timeExprare parsed, and so this method is incapable of performing complete validation.
-
getOutputType
@Nullable ExpressionType getOutputType(Expr.InputBindingInspector inspector, List<Expr> args)
Compute the output type of this function for a given set of argument expression inputs.
-
canVectorize
default boolean canVectorize(Expr.InputBindingInspector inspector, List<Expr> args)
Check if a function can be 'vectorized', for a given set ofExprinputs. If this method returns true,asVectorProcessor(org.apache.druid.math.expr.Expr.VectorInputBindingInspector, java.util.List<org.apache.druid.math.expr.Expr>)is expected to produce aExprVectorProcessorwhich can evaluate values in batches to use with vectorized query engines.
-
asVectorProcessor
default <T> ExprVectorProcessor<T> asVectorProcessor(Expr.VectorInputBindingInspector inspector, List<Expr> args)
Builds a 'vectorized' function expression processor, that can build vectorized processors for its input values usingExpr.asVectorProcessor(org.apache.druid.math.expr.Expr.VectorInputBindingInspector), for use in vectorized query engines.
-
-