Class UnaryArithmeticOperatorNode
java.lang.Object
org.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.UnaryArithmeticOperatorNode
- All Implemented Interfaces:
Visitable
This node represents a unary arithmetic operator
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) final intThis class is used to hold logically different objects for space efficiency.private static final String[]private static final String[]Fields inherited from class UnaryOperatorNode
K_BASE, K_XMLPARSE, K_XMLSERIALIZE, methodName, operand, operator, receiverInterfaceType, resultInterfaceType, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypesFields inherited from class ValueNode
transformedFields inherited from class QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) ValueNodebindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) Bind this operator(package private) voidFor SQRT and ABS the parameter becomes a DOUBLE.private voidBind SQRT or ABSprivate voidcheckOperandIsNumeric(TypeId operandType) Only called for Unary +/-.(package private) voidDo code generation for this unary plus operatorbooleanA +?(package private) booleanSome node classes represent several logical node types (to reduce footprint), which we call kinds.booleanUnary + and - require their type to be set if they wrap another node (e.g. a parameter) that requires type from its context.(package private) voidsetType(DataTypeDescriptor descriptor) We are overwriting this method here because for -?Methods inherited from class UnaryOperatorNode
acceptChildren, addXmlOpMethodParams, bindOperand, categorize, constantExpression, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, getReceiverInterfaceName, isConstantExpression, isEquivalent, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator, toStringMethods inherited from class OperatorNode
pushSqlXmlUtilMethods inherited from class ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, evaluateConstantExpressions, genEqualsFalseTree, generate, genIsNullTree, genSQLJavaSQLTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isInListProbeNode, isRelationalOperator, optimizableEqualityNode, putAndsOnTop, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTopMethods inherited from class QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, 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
-
Field Details
-
UNARY_OPERATORS
-
UNARY_METHODS
-
K_PLUS
static final int K_PLUS- See Also:
-
K_MINUS
static final int K_MINUS- See Also:
-
K_SQRT
static final int K_SQRT- See Also:
-
K_ABS
static final int K_ABS- See Also:
-
kind
final int kindThis class is used to hold logically different objects for space efficiency.kindrepresents the logical object type. See alsoValueNode.isSameNodeKind(ValueNode).
-
-
Constructor Details
-
UnaryArithmeticOperatorNode
UnaryArithmeticOperatorNode(ValueNode operand, int kind, ContextManager cm) throws StandardException - Parameters:
operand- The operand of the nodekind- unary operator identitycm- context manager- Throws:
StandardException
-
-
Method Details
-
requiresTypeFromContext
public boolean requiresTypeFromContext()Unary + and - require their type to be set if they wrap another node (e.g. a parameter) that requires type from its context.- Overrides:
requiresTypeFromContextin classValueNode- Returns:
- Whether this node's type will be determined from the context
- See Also:
-
isParameterNode
public boolean isParameterNode()A +? or a -? is considered a parameter.- Overrides:
isParameterNodein classValueNode
-
bindParameter
For SQRT and ABS the parameter becomes a DOUBLE. For unary + and - no change is made to the underlying node. Once this node's type is set using setType, then the underlying node will have its type set.- Overrides:
bindParameterin classUnaryOperatorNode- Throws:
StandardException- Thrown if ? parameter doesn't have a type bound to it yet. ? parameter where it isn't allowed.
-
bindExpression
ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) throws StandardException Bind this operator- Overrides:
bindExpressionin classUnaryOperatorNode- Parameters:
fromList- The query's FROM listsubqueryList- The subquery list being built as we find SubqueryNodesaggregates- The aggregate list being built as we find AggregateNodes- Returns:
- The new top of the expression tree.
- Throws:
StandardException- Thrown on error
-
checkOperandIsNumeric
Only called for Unary +/-.- Throws:
StandardException
-
generateExpression
Do code generation for this unary plus operator- Overrides:
generateExpressionin classUnaryOperatorNode- Parameters:
acb- The ExpressionClassBuilder for the class we're generatingmb- The method the expression will go into- Throws:
StandardException- Thrown on error
-
bindSQRTABS
Bind SQRT or ABS- Throws:
StandardException- Thrown on error
-
setType
We are overwriting this method here because for -?/+?, we now know the type of these dynamic parameters and hence we can do the parameter binding. The setType method will call the binding code after setting the type of the parameter- Overrides:
setTypein classValueNode- Parameters:
descriptor- The DataTypeServices to set in this ValueNode- Throws:
StandardException
-
isSameNodeKind
Description copied from class:ValueNodeSome node classes represent several logical node types (to reduce footprint), which we call kinds. This means that implementations ofValueNode.isEquivalent(ValueNode)cannot always just useinstanceofto check if the other node represents the same kind. Hence this method needs to be overridden by all node classes that represent several kinds. This default implementation does not look at kinds. It is only called from implementations ofisEquivalent.- Overrides:
isSameNodeKindin classUnaryOperatorNode- Parameters:
o- The other value node whose kind we want to compare with.- Returns:
trueifthisandorepresent the same logical node type, i.e. kind.
-