Record Class SortingColumn

java.lang.Object
java.lang.Record
dev.hardwood.metadata.SortingColumn
Record Components:
columnPath - the leaf column's dotted path as the schema spells it, synthetic list.element and key_value.key segments included
descending - whether the column sorts from greatest to least
nullOrder - where the column's nulls sort

public record SortingColumn(String columnPath, boolean descending, SortingColumn.NullOrder nullOrder) extends Record

One column of the order a row group's rows are sorted in: the column, its direction, and where its nulls go.

A row group's sorting columns order its rows lexicographically: by the first column, rows equal there by the second, and so on. A column's values compare in its column order, the order its statistics use: signed or unsigned by its annotation, a DECIMAL by the number it holds, a STRING byte by byte. A floating-point NaN sorts after every number, and -0.0 equals 0.0.

Build one through ascending(String, SortingColumn.NullOrder) or descending.

See Also:
  • Constructor Details

    • SortingColumn

      public SortingColumn(String columnPath, boolean descending, SortingColumn.NullOrder nullOrder)
      Creates an instance of a SortingColumn record class.
      Parameters:
      columnPath - the value for the columnPath record component
      descending - the value for the descending record component
      nullOrder - the value for the nullOrder record component
  • Method Details

    • ascending

      public static SortingColumn ascending(String columnPath, SortingColumn.NullOrder nullOrder)
      A column sorted from least to greatest.
      Parameters:
      columnPath - the leaf column's dotted path
      nullOrder - where the column's nulls sort
      Returns:
      the sorting column
      Throws:
      IllegalArgumentException - if either argument is null
    • descending

      public static SortingColumn descending(String columnPath, SortingColumn.NullOrder nullOrder)
      A column sorted from greatest to least.
      Parameters:
      columnPath - the leaf column's dotted path
      nullOrder - where the column's nulls sort
      Returns:
      the sorting column
      Throws:
      IllegalArgumentException - if either argument is null
    • nullsFirst

      public boolean nullsFirst()
      Whether the column's nulls sort before its values.
    • toString

      public String toString()
      The column as SQL spells a sort key, such as pickup_ts ASC NULLS FIRST.
      Specified by:
      toString in class Record
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • columnPath

      public String columnPath()
      Returns the value of the columnPath record component.
      Returns:
      the value of the columnPath record component
    • descending

      public boolean descending()
      Returns the value of the descending record component.
      Returns:
      the value of the descending record component
    • nullOrder

      public SortingColumn.NullOrder nullOrder()
      Returns the value of the nullOrder record component.
      Returns:
      the value of the nullOrder record component