Class GroupByList
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.QueryTreeNodeVector<E>
-
- org.apache.derby.impl.sql.compile.OrderedColumnList<GroupByColumn>
-
- org.apache.derby.impl.sql.compile.GroupByList
-
- All Implemented Interfaces:
java.lang.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 Summary
Fields Modifier and Type Field Description (package private) intnumGroupingColsAdded(package private) booleanrollup-
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNodeVector
eltClass
-
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description GroupByList(ContextManager cm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddGroupByColumn(GroupByColumn column)Add a column to the list(package private) voidbindGroupByColumns(SelectNode select, java.util.List<AggregateNode> aggregates)Bind the group by list.(package private) GroupByColumnfindGroupingColumn(ValueNode node)Find the matching grouping column if any for the given expression(package private) GroupByColumngetGroupByColumn(int position)Get a column from the list(package private) intgetNumNeedToAddGroupingCols()Get the number of grouping columns that need to be added to the SELECT list.(package private) booleanisRollup()(package private) voidpreprocess(int numTables, FromList fromList, SubqueryList whereSubquerys, PredicateList wherePredicates)(package private) voidremapColumnReferencesToExpressions()Remap all ColumnReferences in this tree to be clones of the underlying expression.(package private) voidsetRollup()java.lang.StringtoString()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, iterator, nondestructiveAppend, printSubNodes, removeAllElements, removeElement, removeElementAt, setElementAt, size
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Constructor Detail
-
GroupByList
public GroupByList(ContextManager cm)
-
-
Method Detail
-
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, java.util.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 SelectNodeaggregates- 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 StandardExceptionRemap 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:
toStringin classQueryTreeNode- Returns:
- This object as a String
-
preprocess
void preprocess(int numTables, FromList fromList, SubqueryList whereSubquerys, PredicateList wherePredicates) throws StandardException- Throws:
StandardException
-
-