Class ImmutableMeasure

java.lang.Object
io.substrait.relation.Aggregate.Measure
io.substrait.relation.ImmutableMeasure

public final class ImmutableMeasure extends Aggregate.Measure
Immutable implementation of Aggregate.Measure.

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

  • Method Details

    • getFunction

      public AggregateFunctionInvocation getFunction()
      Specified by:
      getFunction in class Aggregate.Measure
      Returns:
      The value of the function attribute
    • getPreMeasureFilter

      public Optional<Expression> getPreMeasureFilter()
      Specified by:
      getPreMeasureFilter in class Aggregate.Measure
      Returns:
      The value of the preMeasureFilter attribute
    • withFunction

      public final ImmutableMeasure withFunction(AggregateFunctionInvocation value)
      Copy the current immutable object by setting a value for the function attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for function
      Returns:
      A modified copy or the this object
    • withPreMeasureFilter

      public final ImmutableMeasure withPreMeasureFilter(Expression value)
      Copy the current immutable object by setting a present value for the optional preMeasureFilter attribute.
      Parameters:
      value - The value for preMeasureFilter
      Returns:
      A modified copy or this if not changed
    • withPreMeasureFilter

      public final ImmutableMeasure withPreMeasureFilter(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the preMeasureFilter attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for preMeasureFilter
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableMeasure 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: function, preMeasureFilter.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableMeasure copyOf(Aggregate.Measure instance)
      Creates an immutable copy of a Aggregate.Measure 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 Measure instance
    • builder

      public static ImmutableMeasure.Builder builder()
      Creates a builder for ImmutableMeasure.
       ImmutableMeasure.builder()
          .function(io.substrait.expression.AggregateFunctionInvocation) // required function
          .preMeasureFilter(Optional<io.substrait.expression.Expression>) // optional preMeasureFilter
          .build();
       
      Returns:
      A new ImmutableMeasure builder