Class UnaryComparisonOperatorNode
- 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.UnaryComparisonOperatorNode
-
- All Implemented Interfaces:
Visitable
- Direct Known Subclasses:
IsNullNode
public abstract class UnaryComparisonOperatorNode extends UnaryOperatorNode
This node is the superclass for all unary comparison operators, such as is null and is not null.
-
-
Field Summary
-
Fields inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode
K_BASE, K_XMLPARSE, K_XMLSERIALIZE, kind, methodName, operand, operator, receiverInterfaceType, resultInterfaceType, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypes
-
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_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description UnaryComparisonOperatorNode(ValueNode operator, ContextManager cm)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
bindComparisonOperator()
Set the type info for this node.(package private) ValueNode
bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates)
Bind this comparison operator.(package private) ValueNode
eliminateNots(boolean underNotNode)
Eliminate NotNodes in the current query block.void
generateAbsoluteColumnId(MethodBuilder mb, Optimizable optTable)
void
generateExpressionOperand(Optimizable optTable, int columnPosition, ExpressionClassBuilderInterface acbi, MethodBuilder mb)
void
generateOrderedNulls(MethodBuilder mb)
void
generateQualMethod(ExpressionClassBuilderInterface acbi, MethodBuilder mb, Optimizable optTable)
void
generateRelativeColumnId(MethodBuilder mb, Optimizable optTable)
private int
getAbsoluteColumnPosition(Optimizable optTable)
Get the absolute 0-based column position of the ColumnReference from the conglomerate for this Optimizable.ColumnReference
getColumnOperand(Optimizable optTable)
ColumnReference
getColumnOperand(Optimizable optTable, int columnPosition)
ValueNode
getExpressionOperand(int tableNumber, int columnNumber, Optimizable ft)
(package private) abstract UnaryOperatorNode
getNegation(ValueNode operand)
Negate the comparison.ValueNode
getOperand(ColumnReference cRef, int refSetSize, boolean otherSide)
int
getOrderableVariantType(Optimizable optTable)
int
getStartOperator(Optimizable optTable)
int
getStopOperator(Optimizable optTable)
boolean
isQualifier(Optimizable optTable, boolean forPush)
boolean
orderedNulls()
boolean
selfComparison(ColumnReference cr)
-
Methods inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode
acceptChildren, addXmlOpMethodParams, bindOperand, bindParameter, categorize, constantExpression, generateExpression, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, getReceiverInterfaceName, isConstantExpression, isEquivalent, isSameNodeKind, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator, toString
-
Methods inherited from class org.apache.derby.impl.sql.compile.OperatorNode
pushSqlXmlUtil
-
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, 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
-
Methods inherited from class org.apache.derby.impl.sql.compile.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
-
-
-
-
Constructor Detail
-
UnaryComparisonOperatorNode
UnaryComparisonOperatorNode(ValueNode operator, ContextManager cm) throws StandardException
- Throws:
StandardException
-
-
Method Detail
-
bindExpression
ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates) throws StandardException
Bind this comparison operator. All that has to be done for binding a comparison operator is to bind the operand and set the result type to SQLBoolean.- Overrides:
bindExpression
in 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
-
bindComparisonOperator
void bindComparisonOperator() throws StandardException
Set the type info for this node. This method is useful both during binding and when we generate nodes within the language module outside of the parser.- Throws:
StandardException
- Thrown on error
-
eliminateNots
ValueNode eliminateNots(boolean underNotNode) throws StandardException
Eliminate NotNodes in the current query block. We traverse the tree, inverting ANDs and ORs and eliminating NOTs as we go. We stop at ComparisonOperators and boolean expressions. We invert ComparisonOperators and replace boolean expressions with boolean expression = false. NOTE: Since we do not recurse under ComparisonOperators, there still could be NotNodes left in the tree.- Overrides:
eliminateNots
in classValueNode
- Parameters:
underNotNode
- Whether or not we are under a NotNode.- Returns:
- The modified expression
- Throws:
StandardException
- Thrown on error
-
getNegation
abstract UnaryOperatorNode getNegation(ValueNode operand) throws StandardException
Negate the comparison.- Parameters:
operand
- The operand of the comparison operator- Returns:
- BinaryOperatorNode The negated expression
- Throws:
StandardException
- Thrown on error
-
getColumnOperand
public ColumnReference getColumnOperand(Optimizable optTable, int columnPosition)
-
getColumnOperand
public ColumnReference getColumnOperand(Optimizable optTable)
-
getOperand
public ValueNode getOperand(ColumnReference cRef, int refSetSize, boolean otherSide)
-
selfComparison
public boolean selfComparison(ColumnReference cr)
-
getExpressionOperand
public ValueNode getExpressionOperand(int tableNumber, int columnNumber, Optimizable ft)
-
generateExpressionOperand
public void generateExpressionOperand(Optimizable optTable, int columnPosition, ExpressionClassBuilderInterface acbi, MethodBuilder mb) throws StandardException
-
getStartOperator
public int getStartOperator(Optimizable optTable)
-
getStopOperator
public int getStopOperator(Optimizable optTable)
-
generateOrderedNulls
public void generateOrderedNulls(MethodBuilder mb)
-
generateQualMethod
public void generateQualMethod(ExpressionClassBuilderInterface acbi, MethodBuilder mb, Optimizable optTable) throws StandardException
-
generateAbsoluteColumnId
public void generateAbsoluteColumnId(MethodBuilder mb, Optimizable optTable)
-
generateRelativeColumnId
public void generateRelativeColumnId(MethodBuilder mb, Optimizable optTable)
-
getAbsoluteColumnPosition
private int getAbsoluteColumnPosition(Optimizable optTable)
Get the absolute 0-based column position of the ColumnReference from the conglomerate for this Optimizable.- Parameters:
optTable
- The Optimizable- Returns:
- The absolute 0-based column position of the ColumnReference
-
orderedNulls
public boolean orderedNulls()
- See Also:
RelationalOperator.orderedNulls()
-
isQualifier
public boolean isQualifier(Optimizable optTable, boolean forPush)
-
getOrderableVariantType
public int getOrderableVariantType(Optimizable optTable) throws StandardException
- Throws:
StandardException
- thrown on error- See Also:
RelationalOperator.getOrderableVariantType(org.apache.derby.iapi.sql.compile.Optimizable)
-
-