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

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.QueryTreeNodeVector
          extended by org.apache.derby.impl.sql.compile.OrderedColumnList
              extended by org.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.


Field Summary
(package private)  int numGroupingColsAdded
           
(package private)  boolean rollup
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
GroupByList()
           
 
Method Summary
 void addGroupByColumn(GroupByColumn column)
          Add a column to the list
 void bindGroupByColumns(SelectNode select, java.util.Vector aggregateVector)
          Bind the group by list.
 GroupByColumn findGroupingColumn(ValueNode node)
          Find the matching grouping column if any for the given expression
 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.
 boolean isRollup()
           
 void preprocess(int numTables, FromList fromList, SubqueryList whereSubquerys, PredicateList wherePredicates)
           
 void remapColumnReferencesToExpressions()
          Remap all ColumnReferences in this tree to be clones of the underlying expression.
 void setRollup()
           
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.OrderedColumnList
getColumnOrdering
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNodeVector
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, 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

rollup

boolean rollup
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

setRollup

public void setRollup()

isRollup

public boolean isRollup()

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
Throws:
StandardException - Thrown on error

findGroupingColumn

public 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

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

Throws:
StandardException - Thrown on error

toString

public java.lang.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

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

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.