Record Class AggregationNode

java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.AggregationNode
Record Components:
groupingKeys - the keys to group by
aggregates - the aggregate functions to apply
input - the source relation
location - the source location of this node; never null
All Implemented Interfaces:
RelNode

public record AggregationNode(List<GroupingKey> groupingKeys, List<AggregateFunction> aggregates, RelNode input, SourceLocation location) extends Record implements RelNode
Represents an aggregation operation (γ) in relational algebra. Groups tuples by the grouping keys and applies aggregate functions.

A grouping key is a full Operand expression, not merely a column reference, so a group may be formed over a derived value — e.g. γ YEAR(occurred_at) → yr, COUNT(id) (Events) — with the common case γ customer_id, SUM(amount) (Orders) simply grouping over a bare column.

  • Constructor Details

    • AggregationNode

      public AggregationNode(List<GroupingKey> groupingKeys, List<AggregateFunction> aggregates, RelNode input, SourceLocation location)
      Creates an instance of a AggregationNode record class.
      Parameters:
      groupingKeys - the value for the groupingKeys record component
      aggregates - the value for the aggregates record component
      input - the value for the input record component
      location - the value for the location record component
    • AggregationNode

      public AggregationNode(List<String> groupingColumns, List<AggregateFunction> aggregates, RelNode input)
      Convenience constructor grouping by bare column names — the classic form, used throughout call sites and tests that group by plain columns. Uses SourceLocation.UNKNOWN. A null column list is preserved as a null grouping (ungrouped aggregation).
  • 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.
    • groupingKeys

      public List<GroupingKey> groupingKeys()
      Returns the value of the groupingKeys record component.
      Returns:
      the value of the groupingKeys record component
    • aggregates

      public List<AggregateFunction> aggregates()
      Returns the value of the aggregates record component.
      Returns:
      the value of the aggregates 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