Class OrderDeriver

java.lang.Object
com.darkcollective.relix.cost.OrderDeriver

public final class OrderDeriver extends Object
Derives the Ordering a RelNode sub-tree is guaranteed to deliver, bottom-up and purely structurally.

Rules

  • Establish — τ (SORT) delivers exactly its sort keys.
  • Preserve — order-preserving operators carry their input's ordering through: σ (selection filters but keeps order), λ (limit/offset takes an ordered prefix), and a relation-only ρ (renames the relation, not its columns).
  • Clear — every other operator delivers Ordering.none() conservatively (it may reorder, regroup, or — for a column-renaming ρ — invalidate the ordering's column names). Under-claiming order is always safe: it only ever keeps a sort that could have been removed.

This is the conservative C1 set; richer propagation (key-preserving π, merge-join output order, sort-capable sources) arrives with the merge operators.

  • Method Details

    • derive

      public static Ordering derive(RelNode node)
      Derives the ordering delivered by node.
      Parameters:
      node - the tree to analyse; must not be null
      Returns:
      the delivered ordering; never null (conservatively Ordering.none() when no order is guaranteed)