Class ImmutableTransformExpression

java.lang.Object
io.substrait.relation.AbstractUpdate.TransformExpression
io.substrait.relation.ImmutableTransformExpression

public final class ImmutableTransformExpression extends AbstractUpdate.TransformExpression
Immutable implementation of AbstractUpdate.TransformExpression.

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

  • Method Details

    • getTransformation

      public Expression getTransformation()
      Returns the expression that computes the new value for the column.
      Specified by:
      getTransformation in class AbstractUpdate.TransformExpression
      Returns:
      transformation expression
    • getColumnTarget

      public int getColumnTarget()
      Returns the index of the target column to update.
      Specified by:
      getColumnTarget in class AbstractUpdate.TransformExpression
      Returns:
      column index
    • withTransformation

      public final ImmutableTransformExpression withTransformation(Expression value)
      Copy the current immutable object by setting a value for the transformation attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for transformation
      Returns:
      A modified copy or the this object
    • withColumnTarget

      public final ImmutableTransformExpression withColumnTarget(int value)
      Copy the current immutable object by setting a value for the columnTarget attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for columnTarget
      Returns:
      A modified copy or the this object
    • equals

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

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

      Creates an immutable copy of a AbstractUpdate.TransformExpression 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 TransformExpression instance
    • builder

      public static ImmutableTransformExpression.Builder builder()
      Creates a builder for ImmutableTransformExpression.
       ImmutableTransformExpression.builder()
          .transformation(io.substrait.expression.Expression) // required transformation
          .columnTarget(int) // required columnTarget
          .build();
       
      Returns:
      A new ImmutableTransformExpression builder