Module com.darkcollective.relix.ast
Package com.darkcollective.relix.ast
Record Class SortSpecification
java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.SortSpecification
A single sort key: the
Operand expression to order by, the direction
(SortDirection.ASC / SortDirection.DESC), and the implicit
NULL placement.
The expression is a full scalar expression, not merely a column reference,
so a relation may be ordered by a derived value — e.g.
τ to_timestamp(logged) DESC (RawLogs). The common case
τ name (Users) is simply an ordering by a bare AttributeOperand.
Null placement is not a surface-syntax option — the parser does not accept
NULLS FIRST/NULLS LAST, so a specification carries no explicit
placement; nullPlacement() gives the SQL-standard default that matches
the direction.
-
Constructor Summary
ConstructorsConstructorDescriptionSortSpecification(Operand expression, SortDirection direction) Creates an instance of aSortSpecificationrecord class.SortSpecification(String attribute, SortDirection direction) Convenience constructor for a sort key over a bare column — wrapsattributeas anAttributeOperand. -
Method Summary
Modifier and TypeMethodDescriptionThe input column name this key orders by, iff the key is a bare attribute reference; empty for a derived expression.Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpressionrecord component.final inthashCode()Returns a hash code value for this object.The effectiveNullPlacementfor this sort key.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SortSpecification
Creates an instance of aSortSpecificationrecord class.- Parameters:
expression- the value for theexpressionrecord componentdirection- the value for thedirectionrecord component
-
SortSpecification
Convenience constructor for a sort key over a bare column — wrapsattributeas anAttributeOperand. Keeps the many call sites (and tests) that sort by a plain column name unchanged.
-
-
Method Details
-
columnName
The input column name this key orders by, iff the key is a bare attribute reference; empty for a derived expression. Ordering-property reasoning andORDER BYpushdown use this to distinguish a plain column from a computed key.- Returns:
- the unqualified column name, or empty for an expression key
-
nullPlacement
The effectiveNullPlacementfor this sort key. Returns the SQL-standard default:NullPlacement.NULLS_LASTforSortDirection.ASCandNullPlacement.NULLS_FIRSTforSortDirection.DESC.This matches the existing sort-executor behaviour, and is used by the merge-join comparator to guarantee consistent
NULLordering on both merge inputs.- Returns:
- the effective null placement; never null
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
expression
Returns the value of theexpressionrecord component.- Returns:
- the value of the
expressionrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-