|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ValueNode
org.apache.derby.impl.sql.compile.OperatorNode
org.apache.derby.impl.sql.compile.UnaryOperatorNode
org.apache.derby.impl.sql.compile.AggregateNode
public class AggregateNode
An Aggregate Node is a node that reprsents a set function/aggregate. It used for all system aggregates as well as user defined aggregates.
| Field Summary | |
|---|---|
private java.lang.Class |
aggregateDefinitionClass
|
private java.lang.String |
aggregateDefinitionClassName
|
private java.lang.String |
aggregateName
|
private java.lang.StringBuffer |
aggregatorClassName
|
private ClassInspector |
classInspector
|
private boolean |
distinct
|
private ResultColumn |
generatedRC
|
private ColumnReference |
generatedRef
|
private AggregateDefinition |
uad
|
private TableName |
userAggregateName
|
| Fields inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode |
|---|
methodName, operand, operator, receiverInterfaceType, resultInterfaceType, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypes, XMLPARSE_OP, XMLSERIALIZE_OP |
| Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode |
|---|
transformed |
| 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 | |
|---|---|
AggregateNode()
|
|
| Method Summary | |
|---|---|
ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
Bind this operator. |
private void |
checkAggregatorClassName(java.lang.String className)
|
boolean |
constantExpression(PredicateList where)
Return whether or not this expression tree represents a constant value. |
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
Do code generation for this unary operator. |
(package private) AggregateDefinition |
getAggregateDefinition()
Get the AggregateDefinition. |
java.lang.String |
getAggregateName()
Get the class that implements that aggregator for this node. |
java.lang.String |
getAggregatorClassName()
Get the class that implements that aggregator for this node. |
ResultColumn |
getGeneratedRC()
Get the generated ResultColumn where this aggregate now resides after a call to replaceAggregatesWithColumnReference(). |
ColumnReference |
getGeneratedRef()
Get the generated ColumnReference to this aggregate after the parent called replaceAggregatesWithColumnReference(). |
ResultColumn |
getNewAggregatorResultColumn(DataDictionary dd)
Get the result column that has a new aggregator. |
ResultColumn |
getNewExpressionResultColumn(DataDictionary dd)
Get the aggregate expression in a new result column. |
ValueNode |
getNewNullResultExpression()
Get the null aggregate result expression column. |
java.lang.String |
getSQLName()
Get the SQL name of the aggregate |
void |
init(java.lang.Object operand,
java.lang.Object uadClass,
java.lang.Object distinct,
java.lang.Object aggregateName)
Intializer. |
private void |
instantiateAggDef()
|
boolean |
isConstant()
|
boolean |
isDistinct()
Indicate whether this aggregate is distinct or not. |
private boolean |
isUserDefinedAggregate()
Return true if this is a user-defined aggregate |
ValueNode |
replaceAggregatesWithColumnReferences(ResultColumnList rcl,
int tableNumber)
Replace aggregates in the expression tree with a ColumnReference to that aggregate, append the aggregate to the supplied RCL (assumed to be from the child ResultSetNode) and return the ColumnReference. |
static AliasDescriptor |
resolveAggregate(DataDictionary dd,
SchemaDescriptor sd,
java.lang.String rawName)
Resolve a user-defined aggregate. |
private void |
setUserDefinedAggregate(UserAggregateDefinition userAgg)
initialize fields for user defined aggregate |
java.lang.String |
toString()
Print a string ref of this node. |
| Methods inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode |
|---|
acceptChildren, addXmlOpMethodParams, bindOperand, bindParameter, categorize, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, getReceiverInterfaceName, init, init, isConstantExpression, isEquivalent, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator |
| Methods inherited from class org.apache.derby.impl.sql.compile.OperatorNode |
|---|
pushSqlXmlUtil |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private boolean distinct
private AggregateDefinition uad
private TableName userAggregateName
private java.lang.StringBuffer aggregatorClassName
private java.lang.String aggregateDefinitionClassName
private java.lang.Class aggregateDefinitionClass
private ClassInspector classInspector
private java.lang.String aggregateName
private ResultColumn generatedRC
private ColumnReference generatedRef
| Constructor Detail |
|---|
public AggregateNode()
| Method Detail |
|---|
public void init(java.lang.Object operand,
java.lang.Object uadClass,
java.lang.Object distinct,
java.lang.Object aggregateName)
throws StandardException
init in interface Nodeinit in class QueryTreeNodeoperand - the value expression for the aggregateuadClass - the class name for user aggregate definition for the aggregate
or the Class for the internal aggregate type.distinct - boolean indicating whether this is distinct
or not.aggregateName - the name of the aggregate from the user's perspective,
e.g. MAX
StandardException - on errorprivate void setUserDefinedAggregate(UserAggregateDefinition userAgg)
public ValueNode replaceAggregatesWithColumnReferences(ResultColumnList rcl,
int tableNumber)
throws StandardException
rcl - The RCL to append to.tableNumber - The tableNumber for the new ColumnReference
StandardException - Thrown on errorAggregateDefinition getAggregateDefinition()
public ResultColumn getGeneratedRC()
public ColumnReference getGeneratedRef()
public ValueNode bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
throws StandardException
bindExpression in class UnaryOperatorNodefromList - The query's FROM listsubqueryList - The subquery list being built as we find SubqueryNodesaggregateVector - The aggregate list being built as we find AggregateNodes
StandardException - Thrown on error
public static AliasDescriptor resolveAggregate(DataDictionary dd,
SchemaDescriptor sd,
java.lang.String rawName)
throws StandardException
StandardException
private void checkAggregatorClassName(java.lang.String className)
throws StandardException
StandardException
private void instantiateAggDef()
throws StandardException
StandardExceptionpublic boolean isDistinct()
public java.lang.String getAggregatorClassName()
public java.lang.String getAggregateName()
public ResultColumn getNewAggregatorResultColumn(DataDictionary dd)
throws StandardException
dd - the data dictionary
StandardException - on error
public ResultColumn getNewExpressionResultColumn(DataDictionary dd)
throws StandardException
dd - the data dictionary
StandardException - on error
public ValueNode getNewNullResultExpression()
throws StandardException
StandardException - on error
public void generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
throws StandardException
generateExpression in class UnaryOperatorNodeacb - The ExpressionClassBuilder for the class we're generatingmb - The method the code to place the code
StandardException - Thrown on errorpublic java.lang.String toString()
toString in class UnaryOperatorNodepublic boolean isConstant()
public boolean constantExpression(PredicateList where)
ValueNode
constantExpression in class UnaryOperatorNodeValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)public java.lang.String getSQLName()
private boolean isUserDefinedAggregate()
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||