Class VerifyAggregateExpressionsVisitor
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.VerifyAggregateExpressionsVisitor
-
- All Implemented Interfaces:
Visitor
class VerifyAggregateExpressionsVisitor extends java.lang.Object implements Visitor
If a RCL (SELECT list) contains an aggregate, then we must verify that the RCL (SELECT list) is valid. For ungrouped queries, the RCL must be composed entirely of valid aggregate expressions - in this case, no column references outside of an aggregate. For grouped aggregates, the RCL must be composed of grouping columns or valid aggregate expressions - in this case, the only column references allowed outside of an aggregate are grouping columns.
-
-
Field Summary
Fields Modifier and Type Field Description private GroupByList
groupByList
-
Constructor Summary
Constructors Constructor Description VerifyAggregateExpressionsVisitor(GroupByList groupByList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
skipChildren(Visitable node)
Don't visit children under an aggregate, subquery or any node which is equivalent to any of the group by expressions.boolean
stopTraversal()
Method that is called to see if query tree traversal should be stopped before visiting all nodes.Visitable
visit(Visitable node)
Verify that this expression is ok for an aggregate query.boolean
visitChildrenFirst(Visitable node)
Method that is called to see ifvisit()
should be called on the children ofnode
before it is called onnode
itself.
-
-
-
Field Detail
-
groupByList
private GroupByList groupByList
-
-
Constructor Detail
-
VerifyAggregateExpressionsVisitor
VerifyAggregateExpressionsVisitor(GroupByList groupByList)
-
-
Method Detail
-
visit
public Visitable visit(Visitable node) throws StandardException
Verify that this expression is ok for an aggregate query.- Specified by:
visit
in interfaceVisitor
- Parameters:
node
- the node to process- Returns:
- me
- Throws:
StandardException
- on ColumnReference not in group by list, ValueNode or JavaValueNode that isn't under an aggregate
-
skipChildren
public boolean skipChildren(Visitable node) throws StandardException
Don't visit children under an aggregate, subquery or any node which is equivalent to any of the group by expressions.- Specified by:
skipChildren
in interfaceVisitor
- Parameters:
node
- the node to process- Returns:
- true/false
- Throws:
StandardException
-
stopTraversal
public boolean stopTraversal()
Description copied from interface:Visitor
Method that is called to see if query tree traversal should be stopped before visiting all nodes. Useful for short circuiting traversal if we already know we are done.- Specified by:
stopTraversal
in interfaceVisitor
- Returns:
- true/false
-
visitChildrenFirst
public boolean visitChildrenFirst(Visitable node)
Description copied from interface:Visitor
Method that is called to see ifvisit()
should be called on the children ofnode
before it is called onnode
itself. If this method always returnstrue
, the visitor will walk the tree bottom-up. If it always returnsfalse
, the tree is visited top-down.- Specified by:
visitChildrenFirst
in interfaceVisitor
- Parameters:
node
- the top node of a sub-tree about to be visited- Returns:
true
ifnode
's children should be visited beforenode
,false
otherwise
-
-