Class ImmutableAggregateFunctionInvocation

java.lang.Object
io.substrait.expression.AggregateFunctionInvocation
io.substrait.expression.ImmutableAggregateFunctionInvocation

public final class ImmutableAggregateFunctionInvocation extends AggregateFunctionInvocation
Immutable implementation of AggregateFunctionInvocation.

Use the builder to create immutable instances: ImmutableAggregateFunctionInvocation.builder().

  • Method Details

    • declaration

      Returns the aggregate function variant declaration.
      Specified by:
      declaration in class AggregateFunctionInvocation
      Returns:
      the function variant declaration
    • arguments

      public List<FunctionArg> arguments()
      Returns the ordered list of function arguments.
      Specified by:
      arguments in class AggregateFunctionInvocation
      Returns:
      list of function arguments
    • options

      public List<FunctionOption> options()
      Returns the options applied to this aggregate function.
      Specified by:
      options in class AggregateFunctionInvocation
      Returns:
      list of function options
    • aggregationPhase

      public Expression.AggregationPhase aggregationPhase()
      Returns the aggregation phase (e.g., initial, intermediate, final).
      Specified by:
      aggregationPhase in class AggregateFunctionInvocation
      Returns:
      aggregation phase
    • sort

      public List<Expression.SortField> sort()
      Returns the sort fields applied to this invocation, if any.
      Specified by:
      sort in class AggregateFunctionInvocation
      Returns:
      list of sort fields
    • outputType

      public Type outputType()
      Returns the output type produced by this invocation.
      Specified by:
      outputType in class AggregateFunctionInvocation
      Returns:
      the output type
    • invocation

      public Expression.AggregationInvocation invocation()
      Returns the aggregation invocation semantics (e.g., aggregate, merge).
      Specified by:
      invocation in class AggregateFunctionInvocation
      Returns:
      aggregation invocation
    • withDeclaration

      Copy the current immutable object by setting a value for the declaration attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for declaration
      Returns:
      A modified copy or the this object
    • withArguments

      public final ImmutableAggregateFunctionInvocation withArguments(FunctionArg... elements)
      Copy the current immutable object with elements that replace the content of arguments.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withArguments

      public final ImmutableAggregateFunctionInvocation withArguments(Iterable<? extends FunctionArg> elements)
      Copy the current immutable object with elements that replace the content of arguments. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of arguments elements to set
      Returns:
      A modified copy or this if not changed
    • withOptions

      public final ImmutableAggregateFunctionInvocation withOptions(FunctionOption... elements)
      Copy the current immutable object with elements that replace the content of options.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withOptions

      public final ImmutableAggregateFunctionInvocation withOptions(Iterable<? extends FunctionOption> elements)
      Copy the current immutable object with elements that replace the content of options. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of options elements to set
      Returns:
      A modified copy or this if not changed
    • withAggregationPhase

      public final ImmutableAggregateFunctionInvocation withAggregationPhase(Expression.AggregationPhase value)
      Copy the current immutable object by setting a value for the aggregationPhase attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for aggregationPhase
      Returns:
      A modified copy or the this object
    • withSort

      public final ImmutableAggregateFunctionInvocation withSort(Expression.SortField... elements)
      Copy the current immutable object with elements that replace the content of sort.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSort

      public final ImmutableAggregateFunctionInvocation withSort(Iterable<? extends Expression.SortField> elements)
      Copy the current immutable object with elements that replace the content of sort. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of sort elements to set
      Returns:
      A modified copy or this if not changed
    • withOutputType

      public final ImmutableAggregateFunctionInvocation withOutputType(Type value)
      Copy the current immutable object by setting a value for the outputType attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for outputType
      Returns:
      A modified copy or the this object
    • withInvocation

      Copy the current immutable object by setting a value for the invocation attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for invocation
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableAggregateFunctionInvocation that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: declaration, arguments, options, aggregationPhase, sort, outputType, invocation.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value AggregateFunctionInvocation with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      Creates an immutable copy of a AggregateFunctionInvocation value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable AggregateFunctionInvocation instance
    • builder

      Creates a builder for ImmutableAggregateFunctionInvocation.
       ImmutableAggregateFunctionInvocation.builder()
          .declaration(io.substrait.extension.SimpleExtension.AggregateFunctionVariant) // required declaration
          .addArguments|addAllArguments(io.substrait.expression.FunctionArg) // arguments elements
          .addOptions|addAllOptions(io.substrait.expression.FunctionOption) // options elements
          .aggregationPhase(io.substrait.expression.Expression.AggregationPhase) // required aggregationPhase
          .addSort|addAllSort(io.substrait.expression.Expression.SortField) // sort elements
          .outputType(io.substrait.type.Type) // required outputType
          .invocation(io.substrait.expression.Expression.AggregationInvocation) // required invocation
          .build();
       
      Returns:
      A new ImmutableAggregateFunctionInvocation builder