Class FunctionCallExpression

java.lang.Object
dev.frostlake.executor.expressions.FunctionCallExpression
All Implemented Interfaces:
Expression

public class FunctionCallExpression extends Object implements Expression
Represents a function call (e.g., UPPER(name), COUNT(*), SUM(salary))
  • Constructor Details

    • FunctionCallExpression

      public FunctionCallExpression(String functionName, List<Expression> arguments)
    • FunctionCallExpression

      public FunctionCallExpression(String functionName, List<Expression> arguments, boolean distinct, boolean star)
    • FunctionCallExpression

      public FunctionCallExpression(String functionName, List<Expression> arguments, List<String> argumentNames)
    • FunctionCallExpression

      public FunctionCallExpression(String displayName, Expression nameExpression, List<Expression> arguments)
      A dynamically named call — IDENTIFIER('fn')(args): displayName keeps the source text (for printing/HAVING matching); nameExpression yields the actual function name.
  • Method Details

    • withArguments

      public FunctionCallExpression withArguments(List<Expression> spliced)
      This call with another argument list and everything else as written — a star spliced in place.
    • getFunctionName

      public String getFunctionName()
    • describeWithinGroup

      public void describeWithinGroup(Expression ordered)
      Record the expression a trailing WITHIN GROUP (ORDER BY …) orders by.

      Evaluation does not read it — the percentile accumulators take the ordered column from the parse tree themselves — but the STATIC channel cannot: PERCENTILE_CONT and PERCENTILE_DISC are typed from the column they order by rather than from the fraction they are handed, and without this the AST node held only the fraction. Read at build for the same reason WindowFunctionExpression.describeWindow(boolean, boolean) reads the OVER clause's shape there: so nothing has to re-parse the call's text later.

      Parameters:
      ordered - the single ORDER BY expression, or null when there is not exactly one
    • getWithinGroupOrdered

      public Expression getWithinGroupOrdered()
      The expression a trailing WITHIN GROUP orders by — see describeWithinGroup(dev.frostlake.executor.expressions.Expression).
    • getArguments

      public List<Expression> getArguments()
    • getArgumentNames

      public List<String> getArgumentNames()
      The per-argument names (parallel to getArguments(); null entry = positional), or null if none are named.
    • isDistinct

      public boolean isDistinct()
    • isStar

      public boolean isStar()
    • getStarExcludes

      public List<String> getStarExcludes()
      Uppercase column names to omit when expanding a * argument (OBJECT_CONSTRUCT(* EXCLUDE …)).
    • getStarQualifier

      public String getStarQualifier()
    • setStarQualifier

      public void setStarQualifier(String starQualifier)
    • getStarIlike

      public String getStarIlike()
    • setStarIlike

      public void setStarIlike(String starIlike)
    • setStarExcludes

      public void setStarExcludes(List<String> starExcludes)
    • getNameParts

      public List<String> getNameParts()
      Canonical name parts (db, schema, fn), or null when the name has none — see the field note.
    • setNameParts

      public void setNameParts(List<String> nameParts)
    • accept

      public <T> T accept(ExpressionVisitor<T> visitor)
      Description copied from interface: Expression
      Accept a visitor for the visitor pattern
      Specified by:
      accept in interface Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNameExpression

      public Expression getNameExpression()
    • getPosition

      public SourcePosition getPosition()
    • setPosition

      public void setPosition(SourcePosition position)