Record Class WindowNode

java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.WindowNode
Record Components:
function - the window computation; never null
partitionKeys - the PER columns; empty = single global partition
sortSpecs - the within-partition ordering; at least one required
frame - the row scope fed to function; never null
outputColumn - the name of the appended result column; never blank
input - the source relation; never null
location - the source location of this node; never null
All Implemented Interfaces:
RelNode

public record WindowNode(WindowFunction function, List<String> partitionKeys, List<SortSpecification> sortSpecs, WindowFrame frame, String outputColumn, RelNode input, SourceLocation location) extends Record implements RelNode
Window operator — a non-collapsing per-partition computation that adds one column to every input row without removing or merging any. It is the algebraic, composable form of SQL's OVER (PARTITION BY … ORDER BY … ROWS …) clause.

A single WindowNode covers all window families via the sealed WindowFunction hierarchy; the WindowFrame sets the scope of rows fed to the function. The surface syntax has two keyword forms:

  • ROLLING — sliding / cumulative aggregates (WindowFunction.AggregateWindow), e.g. ROLLING AVG(price) OVER 3 ROWS SORT trade_time ASC PER ticker AS avg3 (Ticks);
  • WINDOW — ranking and offset functions (slices 3–4).

The output schema is the input schema with outputColumn() appended. partitionKeys() may be empty (one partition over the whole relation — the PER-less form); at least one sort key is required. The operator buffers per partition (BAG materialisation) and never pushes down in this slice.

  • Constructor Details

  • Method Details

    • accept

      public <R> R accept(RelNodeVisitor<R> visitor)
      Specified by:
      accept in interface RelNode
    • 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.
    • function

      public WindowFunction function()
      Returns the value of the function record component.
      Returns:
      the value of the function record component
    • partitionKeys

      public List<String> partitionKeys()
      Returns the value of the partitionKeys record component.
      Returns:
      the value of the partitionKeys record component
    • sortSpecs

      public List<SortSpecification> sortSpecs()
      Returns the value of the sortSpecs record component.
      Returns:
      the value of the sortSpecs record component
    • frame

      public WindowFrame frame()
      Returns the value of the frame record component.
      Returns:
      the value of the frame record component
    • outputColumn

      public String outputColumn()
      Returns the value of the outputColumn record component.
      Returns:
      the value of the outputColumn record component
    • input

      public RelNode input()
      Returns the value of the input record component.
      Returns:
      the value of the input record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Specified by:
      location in interface RelNode
      Returns:
      the value of the location record component