java.lang.Object
java.lang.Record
com.darkcollective.relix.processor.internal.QueryResult
Record Components:
label - display label for this result; never null or blank
schema - the output schema; never null
rows - the result rows in order; never null; may be empty

public record QueryResult(String label, Schema schema, List<Row> rows) extends Record
The fully-materialised result of executing a single query statement.

A QueryResult is produced by QueryExecutor for each query statement in a relix script. It captures:

  • a human-readable label suitable for display headers;
  • the output schema (column names and types);
  • the fully-materialised list of rows.

Instances are immutable. The rows list is an unmodifiable copy.

For named queries (query MyRelation;), the label is the relation name. For inline expression queries (query { π name (Users) };), the label is "<expression N>" where N is the 1-based position of the query in the script.

  • Constructor Summary

    Constructors
    Constructor
    Description
    QueryResult(String label, Schema schema, List<Row> rows)
    Creates an instance of a QueryResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns true if this result contains no rows.
    Returns the value of the label record component.
    int
    Returns the number of rows in this result.
    Returns the value of the rows record component.
    Returns the value of the schema record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • QueryResult

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

    • isEmpty

      public boolean isEmpty()
      Returns true if this result contains no rows.
      Returns:
      true when rows is empty
    • rowCount

      public int rowCount()
      Returns the number of rows in this result.
      Returns:
      the row count; never negative
    • 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.
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • schema

      public Schema schema()
      Returns the value of the schema record component.
      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