public class AggregateNode extends UnaryOperatorNode
Modifier and Type | Field and Description |
---|---|
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 |
methodName, operand, operator, receiverInterfaceType, resultInterfaceType, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypes, XMLPARSE_OP, XMLSERIALIZE_OP
transformed
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
AggregateNode() |
Modifier and Type | Method and Description |
---|---|
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.
|
acceptChildren, addXmlOpMethodParams, bindOperand, bindParameter, categorize, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, getReceiverInterfaceName, init, init, isConstantExpression, isEquivalent, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator
pushSqlXmlUtil
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, evaluateConstantExpressions, genEqualsFalseTree, generate, generateFilter, genIsNullTree, genSQLJavaSQLTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeType, optimizableEqualityNode, putAndsOnTop, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
accept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, 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
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
public void init(java.lang.Object operand, java.lang.Object uadClass, java.lang.Object distinct, java.lang.Object aggregateName) throws StandardException
init
in interface Node
init
in class QueryTreeNode
operand
- 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. MAXStandardException
- 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 ColumnReferenceStandardException
- 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 UnaryOperatorNode
fromList
- The query's FROM listsubqueryList
- The subquery list being built as we find SubqueryNodesaggregateVector
- The aggregate list being built as we find AggregateNodesStandardException
- Thrown on errorpublic 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
StandardException
public boolean isDistinct()
public java.lang.String getAggregatorClassName()
public java.lang.String getAggregateName()
public ResultColumn getNewAggregatorResultColumn(DataDictionary dd) throws StandardException
dd
- the data dictionaryStandardException
- on errorpublic ResultColumn getNewExpressionResultColumn(DataDictionary dd) throws StandardException
dd
- the data dictionaryStandardException
- on errorpublic ValueNode getNewNullResultExpression() throws StandardException
StandardException
- on errorpublic void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class UnaryOperatorNode
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the code to place the codeStandardException
- Thrown on errorpublic java.lang.String toString()
toString
in class UnaryOperatorNode
public boolean isConstant()
public boolean constantExpression(PredicateList where)
ValueNode
constantExpression
in class UnaryOperatorNode
ValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)
public java.lang.String getSQLName()
private boolean isUserDefinedAggregate()
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.