Class ApplyFunction.FoldFunction

java.lang.Object
org.apache.druid.math.expr.ApplyFunction.BaseFoldFunction
org.apache.druid.math.expr.ApplyFunction.FoldFunction
All Implemented Interfaces:
ApplyFunction, NamedFunction
Enclosing interface:
ApplyFunction

public static class ApplyFunction.FoldFunction extends ApplyFunction.BaseFoldFunction
Accumulate a value for a single array input with a 2 argument LambdaExpr. The 'array' input expression is the first argument, the initial value for the accumulator expression is the 2nd argument.
  • Constructor Details

    • FoldFunction

      public FoldFunction()
  • Method Details

    • name

      public String name()
      Description copied from interface: NamedFunction
      Name of the function
    • apply

      public ExprEval apply(LambdaExpr lambdaExpr, List<Expr> argsExpr, Expr.ObjectBinding bindings)
      Description copied from interface: ApplyFunction
      Apply LambdaExpr to argument list of Expr given a set of outer Expr.ObjectBinding. These outer bindings will be used to form the scope for the bindings used to evaluate the LambdaExpr, which use the array inputs to supply scalar values to use as bindings for IdentifierExpr in the lambda body.
    • getArrayInputs

      public Set<Expr> getArrayInputs(List<Expr> args)
      Description copied from interface: ApplyFunction
      Get list of input arguments which must evaluate to an array ExprType
    • validateArguments

      public void validateArguments(LambdaExpr lambdaExpr, List<Expr> args)
      Description copied from interface: ApplyFunction
      Validate function arguments. This method is called whenever a ApplyFunctionExpr is created, and should validate everything that is feasible up front. Note that input type information is typically unavailable at the time Expr are parsed, and so this method is incapable of performing complete validation.