Class ScalarFunction

All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable, PromqlPlan

public final class ScalarFunction extends LeafPlan implements PromqlPlan
Represents a PromQL function call that produces a scalar value and has no arguments.

These functions return a scalar value directly. This corresponds to PromQL syntax:

 scalar_function()
 
Examples: time(), pi()
  • Constructor Details

    • ScalarFunction

      public ScalarFunction(Source source, String functionName)
  • Method Details

    • info

      protected NodeInfo<? extends LogicalPlan> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods to implement this.

      For QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<LogicalPlan>
    • expressionsResolved

      public boolean expressionsResolved()
      Specified by:
      expressionsResolved in class LogicalPlan
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class LogicalPlan
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class LogicalPlan
    • output

      public List<Attribute> output()
      Description copied from class: QueryPlan
      The ordered list of attributes (i.e. columns) this plan produces when executed. Must be called only on resolved plans, otherwise may throw an exception or return wrong results.
      Specified by:
      output in interface PromqlPlan
      Specified by:
      output in class QueryPlan<LogicalPlan>
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • returnType

      public PromqlDataType returnType()
      Description copied from interface: PromqlPlan
      The PromQL return type of this plan node.
      Specified by:
      returnType in interface PromqlPlan
    • functionName

      public String functionName()