Record Class SortedBagRelation

java.lang.Object
java.lang.Record
com.darkcollective.relix.processor.exec.SortedBagRelation
Record Components:
schema - the schema shared by all rows; never null
rows - the sorted list of rows; a defensive copy is stored; never null
All Implemented Interfaces:
MaterializedRelation

public record SortedBagRelation(Schema schema, List<Row> rows) extends Record implements MaterializedRelation
A materialised relation whose rows are kept in a stable sorted order and may contain duplicates — the Sorted bag type in the IBM flat-collection taxonomy (No Key, No Element Equality required, Sorted, Multiple).

The sort order is determined externally by the SortNode executor, which collects the input rows, applies a Comparator, and stores the result here. The list is immutable after construction.

This is the natural output type for the SORT (τ) operator. Downstream operators that consume a sorted relation (e.g. a LIMIT applied after a SORT) receive a stream in the correct order without any additional sorting.

  • Constructor Details

    • SortedBagRelation

      public SortedBagRelation(Schema schema, List<Row> rows)
      Creates an instance of a SortedBagRelation record class.
      Parameters:
      schema - the value for the schema record component
      rows - the value for the rows record component
  • Method Details

    • of

      public static SortedBagRelation of(Schema schema, List<Row> rows)
      Factory that accepts a mutable list and stores a defensive copy.
    • stream

      public Stream<Row> stream()
      Description copied from interface: MaterializedRelation
      Returns a lazy stream over all rows in this relation. The stream may be consumed exactly once.
      Specified by:
      stream in interface MaterializedRelation
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • schema

      public Schema schema()
      Returns the value of the schema record component.
      Specified by:
      schema in interface MaterializedRelation
      Returns:
      the value of the schema record component
    • rows

      public List<Row> rows()
      Returns the value of the rows record component.
      Returns:
      the value of the rows record component