Class ImmutableExchangeTarget

java.lang.Object
io.substrait.relation.physical.AbstractExchangeRel.ExchangeTarget
io.substrait.relation.physical.ImmutableExchangeTarget

public final class ImmutableExchangeTarget extends AbstractExchangeRel.ExchangeTarget
Immutable implementation of AbstractExchangeRel.ExchangeTarget.

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

  • Method Details

    • getPartitionIds

      public List<Integer> getPartitionIds()
      Returns the partition IDs served by this target.
      Specified by:
      getPartitionIds in class AbstractExchangeRel.ExchangeTarget
      Returns:
      list of partition IDs
    • getType

      public TargetType getType()
      Returns the target type (e.g., local, remote).
      Specified by:
      getType in class AbstractExchangeRel.ExchangeTarget
      Returns:
      the target type
    • withPartitionIds

      public final ImmutableExchangeTarget withPartitionIds(int... elements)
      Copy the current immutable object with elements that replace the content of partitionIds.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withPartitionIds

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

      public final ImmutableExchangeTarget withType(TargetType value)
      Copy the current immutable object by setting a value for the type attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type
      Returns:
      A modified copy or the this object
    • equals

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

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

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

      public static ImmutableExchangeTarget.Builder builder()
      Creates a builder for ImmutableExchangeTarget.
       ImmutableExchangeTarget.builder()
          .addPartitionIds|addAllPartitionIds(int) // partitionIds elements
          .type(io.substrait.relation.physical.TargetType) // required type
          .build();
       
      Returns:
      A new ImmutableExchangeTarget builder