org.apache.derby.impl.sql.compile
Class GroupByList

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.QueryTreeNodeVector
          extended byorg.apache.derby.impl.sql.compile.OrderedColumnList
              extended byorg.apache.derby.impl.sql.compile.GroupByList
All Implemented Interfaces:
Visitable

public class GroupByList
extends OrderedColumnList

A GroupByList represents the list of expressions in a GROUP BY clause in a SELECT statement.

Author:
Jeff Lichtman

Field Summary
(package private)  int numGroupingColsAdded
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
GroupByList()
           
 
Method Summary
 void addGroupByColumn(GroupByColumn column)
          Add a column to the list
 void addNewGroupingColumnsToRCL(SelectNode selectNode)
          Add any grouping columns which are not already in the appropriate RCL to the RCL.
 void bindGroupByColumns(SelectNode select, java.util.Vector aggregateVector)
          Bind the group by list.
 GroupByColumn containsColumnReference(ColumnReference cr)
           
 GroupByColumn getGroupByColumn(int position)
          Get a column from the list
 int getNumNeedToAddGroupingCols()
          Get the number of grouping columns that need to be added to the SELECT list.
 void printSubNodes(int depth)
          Print the list.
 void remapColumnReferencesToExpressions()
          Remap all ColumnReferences in this tree to be clones of the underlying expression.
 java.lang.String toString()
          Print it out, baby
 void verifyUniqueGroupingColumns()
          Check the uniqueness of the column names within a GROUP BY list.
 
Methods inherited from class org.apache.derby.impl.sql.compile.OrderedColumnList
accept, addElement, destructiveAppend, elementAt, getColumnOrdering, indexOf, insertElementAt, nondestructiveAppend, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
bind, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numGroupingColsAdded

int numGroupingColsAdded
Constructor Detail

GroupByList

public GroupByList()
Method Detail

addGroupByColumn

public void addGroupByColumn(GroupByColumn column)
Add a column to the list

Parameters:
column - The column to add to the list

getGroupByColumn

public GroupByColumn getGroupByColumn(int position)
Get a column from the list

Parameters:
position - The column to get from the list

printSubNodes

public void printSubNodes(int depth)
Print the list.

Overrides:
printSubNodes in class QueryTreeNode
Parameters:
depth - The depth at which to indent the sub-nodes
Returns:
Nothing

getNumNeedToAddGroupingCols

public 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

public void bindGroupByColumns(SelectNode select,
                               java.util.Vector aggregateVector)
                        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
aggregateVector - The aggregate vector being built as we find AggregateNodes
Returns:
Nothing.
Throws:
StandardException - Thrown on error

verifyUniqueGroupingColumns

public void verifyUniqueGroupingColumns()
                                 throws StandardException
Check the uniqueness of the column names within a GROUP BY list.

Returns:
Nothing.
Throws:
StandardException - Thrown on error

addNewGroupingColumnsToRCL

public void addNewGroupingColumnsToRCL(SelectNode selectNode)
                                throws StandardException
Add any grouping columns which are not already in the appropriate RCL to the RCL. NOTE: The RC/VCNs in the SELECT list will point to the same pool of ResultColumns as the GroupByColumns in this list.

Parameters:
selectNode - The SelectNode whose RCL we add to.
Returns:
Nothing.
Throws:
StandardException - Thrown on error

containsColumnReference

public GroupByColumn containsColumnReference(ColumnReference cr)

remapColumnReferencesToExpressions

public void remapColumnReferencesToExpressions()
                                        throws StandardException
Remap all ColumnReferences in this tree to be clones of the underlying expression.

Returns:
Nothing.
Throws:
StandardException - Thrown on error

toString

public java.lang.String toString()
Print it out, baby

Overrides:
toString in class QueryTreeNodeVector
Returns:
This list formatted as a String

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.