Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class VerifyAggregateExpressionsVisitor

extends Object
implements Visitor
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.compile.Visitor
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.sql.compile.Visitable, .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

Modifier and TypeField and Description
private GroupByList

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true/false
skipChildren
(Visitable
the node to process
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.skipChildren.

Don't visit children under an aggregate, subquery or any node which is equivalent to any of the group by expressions.

public boolean
stopTraversal()

Implements org.apache.derby.iapi.sql.compile.Visitor.stopTraversal.

Method that is called to see if query tree traversal should be stopped before visiting all nodes.

public Visitable

Returns:

me
visit
(Visitable
the node to process
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.visit.

Verify that this expression is ok for an aggregate query.

public boolean
visitChildrenFirst(Visitable
the top node of a sub-tree about to be visited
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Method that is called to see if visit() should be called on the children of node before it is called on node itself.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

groupByListback to summary
private GroupByList groupByList

Constructor Detail

VerifyAggregateExpressionsVisitorback to summary
pack-priv VerifyAggregateExpressionsVisitor(GroupByList groupByList)

Method Detail

skipChildrenback to summary
public boolean skipChildren(Visitable node) throws StandardException

Implements org.apache.derby.iapi.sql.compile.Visitor.skipChildren.

Don't visit children under an aggregate, subquery or any node which is equivalent to any of the group by expressions.

Parameters
node:Visitable

the node to process

Returns:boolean

true/false

stopTraversalback to summary
public boolean stopTraversal()

Implements org.apache.derby.iapi.sql.compile.Visitor.stopTraversal.

Doc from org.apache.derby.iapi.sql.compile.Visitor.stopTraversal.

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.

Returns:boolean

true/false

visitback to summary
public Visitable visit(Visitable node) throws StandardException

Implements org.apache.derby.iapi.sql.compile.Visitor.visit.

Verify that this expression is ok for an aggregate query.

Parameters
node:Visitable

the node to process

Returns:Visitable

me

Exceptions
StandardException:
on ColumnReference not in group by list, ValueNode or JavaValueNode that isn't under an aggregate
visitChildrenFirstback to summary
public boolean visitChildrenFirst(Visitable node)

Implements org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Doc from org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Method that is called to see if visit() should be called on the children of node before it is called on node itself. If this method always returns true, the visitor will walk the tree bottom-up. If it always returns false, the tree is visited top-down.

Parameters
node:Visitable

the top node of a sub-tree about to be visited

Returns:boolean

true if node's children should be visited before node, false otherwise