Class GroupByList

All Implemented Interfaces:
Iterable<GroupByColumn>, Visitable

class GroupByList extends OrderedColumnList<GroupByColumn>
A GroupByList represents the list of expressions in a GROUP BY clause in a SELECT statement.
  • Field Details

    • numGroupingColsAdded

      int numGroupingColsAdded
    • rollup

      boolean rollup
  • Constructor Details

  • Method Details

    • addGroupByColumn

      void addGroupByColumn(GroupByColumn column)
      Add a column to the list
      Parameters:
      column - The column to add to the list
    • getGroupByColumn

      GroupByColumn getGroupByColumn(int position)
      Get a column from the list
      Parameters:
      position - The column to get from the list
    • setRollup

      void setRollup()
    • isRollup

      boolean isRollup()
    • getNumNeedToAddGroupingCols

      int getNumNeedToAddGroupingCols()
      Get the number of grouping columns that need to be added to the SELECT list.
      Returns:
      int The number of grouping columns that need to be added to the SELECT list.
    • bindGroupByColumns

      void bindGroupByColumns(SelectNode select, List<AggregateNode> aggregates) throws StandardException
      Bind the group by list. Verify: o Number of grouping columns matches number of non-aggregates in SELECT's RCL. o Names in the group by list are unique o Names of grouping columns match names of non-aggregate expressions in SELECT's RCL.
      Parameters:
      select - The SelectNode
      aggregates - The aggregate list being built as we find AggregateNodes
      Throws:
      StandardException - Thrown on error
    • findGroupingColumn

      GroupByColumn findGroupingColumn(ValueNode node) throws StandardException
      Find the matching grouping column if any for the given expression
      Parameters:
      node - an expression for which we are trying to find a match in the group by list.
      Returns:
      the matching GroupByColumn if one exists, null otherwise.
      Throws:
      StandardException
    • remapColumnReferencesToExpressions

      void remapColumnReferencesToExpressions() throws StandardException
      Remap all ColumnReferences in this tree to be clones of the underlying expression.
      Throws:
      StandardException - Thrown on error
    • toString

      public String toString()
      Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.
      Overrides:
      toString in class QueryTreeNode
      Returns:
      This object as a String
    • preprocess

      void preprocess(int numTables, FromList fromList, SubqueryList whereSubquerys, PredicateList wherePredicates) throws StandardException
      Throws:
      StandardException