Class Sorting

java.lang.Object
org.apache.druid.sql.calcite.rel.Sorting

public class Sorting extends Object
Represents Druid's concept of sorting and limiting, including post-sort projections. The sorting and limiting piece may map onto multiple Druid concepts: LimitSpec (for groupBy), TopNMetricSpec and threshold (for topN), "descending" (for timeseries), or ScanQuery.Order (for scan). The post-sort projections will map onto either post-aggregations (for query types that aggregate) or virtual columns (for query types that don't). This corresponds to a Calcite Sort + optional Project.
  • Method Details

    • create

      public static Sorting create(List<OrderByColumnSpec> orderBys, OffsetLimit offsetLimit, @Nullable Projection projection)
    • none

      public static Sorting none()
    • getTimeSortKind

      public org.apache.druid.sql.calcite.rel.Sorting.SortKind getTimeSortKind(String timeColumn)
    • getOrderBys

      public List<OrderByColumnSpec> getOrderBys()
    • getProjection

      @Nullable public Projection getProjection()
    • getOffsetLimit

      public OffsetLimit getOffsetLimit()
    • limitSpec

      public LimitSpec limitSpec()
      Returns a LimitSpec that encapsulates the orderBys, offset, and limit of this Sorting instance. Does not encapsulate the projection at all; you must still call getProjection() for that.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object