Visitable
AggregateNode
, DB2LengthOperatorNode
, ExtractOperatorNode
, LengthOperatorNode
, SimpleStringOperatorNode
, UnaryArithmeticOperatorNode
, UnaryComparisonOperatorNode
, UnaryDateTimestampOperatorNode
, UnaryLogicalOperatorNode
, WindowFunctionNode
class UnaryOperatorNode extends OperatorNode
Modifier and Type | Field | Description |
---|---|---|
(package private) static int |
K_BASE |
|
(package private) static int |
K_XMLPARSE |
|
(package private) static int |
K_XMLSERIALIZE |
|
(package private) int |
kind |
This class is used to hold logically different objects for
space efficiency.
|
(package private) java.lang.String |
methodName |
|
(package private) ValueNode |
operand |
WARNING: operand may be NULL for COUNT(*).
|
(package private) java.lang.String |
operator |
|
private boolean |
preserveWhitespace |
Whether or not an XMLParse operator should preserve whitespace.
|
(package private) java.lang.String |
receiverInterfaceType |
|
(package private) java.lang.String |
resultInterfaceType |
|
private DataTypeDescriptor |
targetType |
Target type for XMLSerialize operator.
|
(package private) static java.lang.String[] |
UnaryArgTypes |
|
(package private) static java.lang.String[] |
UnaryMethodNames |
|
(package private) static java.lang.String[] |
UnaryOperators |
|
(package private) static java.lang.String[] |
UnaryResultTypes |
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
transformed
Constructor | Description |
---|---|
UnaryOperatorNode(ValueNode operand,
int kind,
DataTypeDescriptor targetType,
boolean preserveWhiteSpace,
ContextManager cm) |
Constructor for a UnaryOperatorNode when used as a concrete class.
|
UnaryOperatorNode(ValueNode operand,
java.lang.String operator,
java.lang.String methodNameOrAddedArgs,
ContextManager cm) |
When UnaryOperatorNode is used as an base class, this
constructor is used as
super . |
UnaryOperatorNode(ValueNode operand,
ContextManager cm) |
When UnaryOperatorNode is used as an base class, this
constructor is used as
super . |
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
acceptChildren(Visitor v) |
Accept the visitor for all visitable children of this node.
|
(package private) int |
addXmlOpMethodParams(ExpressionClassBuilder acb,
MethodBuilder mb,
LocalField resultField) |
Add some additional arguments to our method call for
XML related operations like XMLPARSE and XMLSERIALIZE.
|
(package private) ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List<AggregateNode> aggregates) |
Bind this expression.
|
protected void |
bindOperand(FromList fromList,
SubqueryList subqueryList,
java.util.List<AggregateNode> aggregates) |
Bind the operand for this unary operator.
|
(package private) void |
bindParameter() |
By default unary operators don't accept ?
|
private void |
bindXMLParse() |
Bind an XMLPARSE operator.
|
private void |
bindXMLSerialize() |
Bind an XMLSERIALIZE operator.
|
(package private) boolean |
categorize(JBitSet referencedTabs,
boolean simplePredsOnly) |
Categorize this predicate.
|
(package private) boolean |
constantExpression(PredicateList whereClause) |
Return whether or not this expression tree represents a constant value.
|
(package private) void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb) |
Do code generation for this unary operator.
|
(package private) ValueNode |
getOperand() |
Get the operand of this unary operator.
|
(package private) java.lang.String |
getOperatorString() |
Get the operator of this unary operator.
|
protected int |
getOrderableVariantType() |
Return the variant type for the underlying expression.
|
(package private) ParameterNode |
getParameterOperand() |
Get the parameter operand of this unary operator.
|
(package private) java.lang.String |
getReceiverInterfaceName() |
Determine the type the binary method is called on.
|
(package private) boolean |
isConstantExpression() |
Return whether or not this expression tree represents a constant expression.
|
(package private) boolean |
isEquivalent(ValueNode o) |
Tests if this node is equivalent to the specified ValueNode.
|
(package private) boolean |
isSameNodeKind(ValueNode o) |
Some node classes represent several logical node types (to reduce
footprint), which we call kinds.
|
(package private) ValueNode |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList) |
Preprocess an expression tree.
|
(package private) void |
printSubNodes(int depth) |
Prints the sub-nodes of this object.
|
(package private) ValueNode |
remapColumnReferencesToExpressions() |
Remap all ColumnReferences in this tree to be clones of the
underlying expression.
|
(package private) void |
setMethodName(java.lang.String methodName) |
Set the methodName.
|
(package private) void |
setOperator(java.lang.String operator) |
Set the operator.
|
java.lang.String |
toString() |
Convert this object to a String.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
pushSqlXmlUtil
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
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, isParameterNode, isRelationalOperator, optimizableEqualityNode, putAndsOnTop, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
java.lang.String operator
java.lang.String methodName
java.lang.String resultInterfaceType
java.lang.String receiverInterfaceType
ValueNode operand
static final int K_XMLPARSE
static final int K_XMLSERIALIZE
static final int K_BASE
final int kind
kind
represents the logical object
type. See also ValueNode.isSameNodeKind(org.apache.derby.impl.sql.compile.ValueNode)
.static final java.lang.String[] UnaryOperators
static final java.lang.String[] UnaryMethodNames
static final java.lang.String[] UnaryResultTypes
static final java.lang.String[] UnaryArgTypes
private DataTypeDescriptor targetType
private boolean preserveWhitespace
UnaryOperatorNode(ValueNode operand, java.lang.String operator, java.lang.String methodNameOrAddedArgs, ContextManager cm) throws StandardException
super
.StandardException
UnaryOperatorNode(ValueNode operand, ContextManager cm)
super
.UnaryOperatorNode(ValueNode operand, int kind, DataTypeDescriptor targetType, boolean preserveWhiteSpace, ContextManager cm)
operand
- The operand of the nodekind
- The kind of operatortargetType
- The DTD of the target typepreserveWhiteSpace
- true
if white space is to be preserved
(relevant for kind == XMLPARSE only)cm
- The context managervoid setOperator(java.lang.String operator)
operator
- The operator.java.lang.String getOperatorString()
void setMethodName(java.lang.String methodName)
methodName
- The methodName.public java.lang.String toString()
void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the treeValueNode getOperand()
ParameterNode getParameterOperand() throws StandardException
StandardException
ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates) throws StandardException
bindExpression
in class ValueNode
fromList
- The FROM list for the query this
expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregates
- The aggregate list being built as we find AggregateNodesStandardException
- Thrown on errorprotected void bindOperand(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates) throws StandardException
StandardException
private void bindXMLParse() throws StandardException
StandardException
- Thrown on errorprivate void bindXMLSerialize() throws StandardException
StandardException
- Thrown on errorValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException
preprocess
in class ValueNode
numTables
- Number of tables in the DML StatementouterFromList
- FromList from outer query blockouterSubqueryList
- SubqueryList from outer query blockouterPredicateList
- PredicateList from outer query blockStandardException
- Thrown on errorboolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws StandardException
categorize
in class ValueNode
referencedTabs
- JBitSet with bit map of referenced FromTablessimplePredsOnly
- Whether or not to consider method
calls, field references and conditional nodes
when building bit mapStandardException
- Thrown on errorValueNode remapColumnReferencesToExpressions() throws StandardException
remapColumnReferencesToExpressions
in class ValueNode
StandardException
- Thrown on errorboolean isConstantExpression()
isConstantExpression
in class ValueNode
boolean constantExpression(PredicateList whereClause)
ValueNode
constantExpression
in class ValueNode
ValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)
void bindParameter() throws StandardException
StandardException
- Thrown if ? parameter doesn't
have a type bound to it yet.
? parameter where it isn't allowed.void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class ValueNode
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the expression will go intoStandardException
- Thrown on errorjava.lang.String getReceiverInterfaceName() throws StandardException
StandardException
- Thrown on errorprotected int getOrderableVariantType() throws StandardException
getOrderableVariantType
in class ValueNode
StandardException
- thrown on errorvoid acceptChildren(Visitor v) throws StandardException
acceptChildren
in class QueryTreeNode
v
- the visitorStandardException
- on errorint addXmlOpMethodParams(ExpressionClassBuilder acb, MethodBuilder mb, LocalField resultField) throws StandardException
acb
- the builder for the class in which the method livesmb
- The MethodBuilder that will make the call.resultField
- the field that contains the previous resultStandardException
boolean isEquivalent(ValueNode o) throws StandardException
ValueNode
This method provides basic expression matching facility for the derived class of ValueNode and it is used by the language layer to compare the node structural form of the two expressions for equivalence at bind phase.
Note that it is not comparing the actual row values at runtime to produce a result; hence, when comparing SQL NULLs, they are considered to be equivalent and not unknown.
One usage case of this method in this context is to compare the select column expression against the group by expression to check if they are equivalent. e.g.:
SELECT c1+c2 FROM t1 GROUP BY c1+c2
In general, node equivalence is determined by the derived class of ValueNode. But they generally abide to the rules below:
isEquivalent
in class ValueNode
o
- the node to compare this ValueNode against.true
if the two nodes are equivalent,
false
otherwise.StandardException
boolean isSameNodeKind(ValueNode o)
ValueNode
ValueNode.isEquivalent(org.apache.derby.impl.sql.compile.ValueNode)
cannot always just use instanceof
to 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 of isEquivalent
.isSameNodeKind
in class ValueNode
o
- The other value node whose kind we want to compare with.true
if this
and o
represent the same
logical node type, i.e. kind.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.