Class IsNullNode
- All Implemented Interfaces:
Visitable, RelationalOperator
This node represents either a unary
IS NULL or IS NOT NULL comparison operator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIftrue, this node represents a NOT NULL node rather than a NULL node.private DataValueDescriptorFields inherited from class UnaryOperatorNode
K_BASE, K_XMLPARSE, K_XMLSERIALIZE, kind, 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_INDEXFields inherited from interface RelationalOperator
EQUALS_RELOP, GREATER_EQUALS_RELOP, GREATER_THAN_RELOP, IS_NOT_NULL_RELOP, IS_NULL_RELOP, LESS_EQUALS_RELOP, LESS_THAN_RELOP, NOT_EQUALS_RELOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidBind a ?booleancompareWithKnownConstant(Optimizable optTable, boolean considerParameters) Return whether this operator compares the given Optimizable with a constant whose value is known at compile time.booleanReturn whether this operator is an equality comparison of the given optimizable with a constant expression.voidgenerateNegate(MethodBuilder mb, Optimizable optTable) Generate an expression that evaluates to true if the result of the comparison should be negated.voidgenerateOperator(MethodBuilder mb, Optimizable optTable) Generate the comparison operator for this RelationalOperator.getCompareValue(Optimizable optTable) Return an Object representing the known value that this relational operator is comparing to a column in the given Optimizable.(package private) UnaryOperatorNodegetNegation(ValueNode operand) Negate the comparison.intReturn the operator (as an int) for this RelationalOperator.(package private) Stringnull operators are defined on DataValueDescriptor.intgetStartOperator(Optimizable optTable) Get the start operator for a scan (at the store level) for this RelationalOperator.intgetStopOperator(Optimizable optTable) Get the stop operator for a scan (at the store level) for this RelationalOperator.getTransitiveSearchClause(ColumnReference otherCR) Return a relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.(package private) boolean(package private) booleanReturns true if this ValueNode is a relational operator.(package private) booleanoptimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay) Return true if the predicate represents an optimizable equality node.doubleselectivity(Optimizable optTable) The default selectivity for value nodes is 50%.private voidbooleanusefulStartKey(Optimizable optTable) Tell whether this relop is a useful start key for the given table.booleanusefulStopKey(Optimizable optTable) Tell whether this relop is a useful stop key for the given table.Methods inherited from class UnaryComparisonOperatorNode
bindComparisonOperator, bindExpression, eliminateNots, generateAbsoluteColumnId, generateExpressionOperand, generateOrderedNulls, generateQualMethod, generateRelativeColumnId, getColumnOperand, getColumnOperand, getExpressionOperand, getOperand, getOrderableVariantType, isQualifier, orderedNulls, selfComparisonMethods inherited from class UnaryOperatorNode
acceptChildren, addXmlOpMethodParams, bindOperand, categorize, constantExpression, generateExpression, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, isConstantExpression, isEquivalent, isSameNodeKind, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator, toStringMethods inherited from class OperatorNode
pushSqlXmlUtilMethods inherited from class 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, putAndsOnTop, requiresTypeFromContext, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, 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, verifyClassExistMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface RelationalOperator
generateAbsoluteColumnId, generateExpressionOperand, generateOrderedNulls, generateQualMethod, generateRelativeColumnId, getColumnOperand, getColumnOperand, getExpressionOperand, getOperand, getOrderableVariantType, isQualifier, orderedNulls, selfComparison
-
Field Details
-
nullValue
-
notNull
private boolean notNullIftrue, this node represents a NOT NULL node rather than a NULL node. Note that this state is mutable, cfgetNegation(ValueNode).
-
-
Constructor Details
-
IsNullNode
IsNullNode(ValueNode operand, boolean notNull, ContextManager cm) throws StandardException - Throws:
StandardException
-
-
Method Details
-
updateOperatorDetails
private void updateOperatorDetails() -
getNegation
Negate the comparison.- Specified by:
getNegationin classUnaryComparisonOperatorNode- Parameters:
operand- The operand of the operator- Returns:
- UnaryOperatorNode The negated expression
- Throws:
StandardException- Thrown on error
-
bindParameter
Bind a ? parameter operand of the IS [NOT] NULL predicate.- Overrides:
bindParameterin classUnaryOperatorNode- Throws:
StandardException- Thrown on error
-
usefulStartKey
Description copied from interface:RelationalOperatorTell whether this relop is a useful start key for the given table. It has already been determined that the relop has a column from the given table on one side or the other.- Specified by:
usefulStartKeyin interfaceRelationalOperator- Parameters:
optTable- The Optimizable table for which we want to know whether this is a useful start key.- Returns:
- true if this is a useful start key
- See Also:
-
usefulStopKey
Description copied from interface:RelationalOperatorTell whether this relop is a useful stop key for the given table. It has already been determined that the relop has a column from the given table on one side or the other.- Specified by:
usefulStopKeyin interfaceRelationalOperator- Parameters:
optTable- The Optimizable table for which we want to know whether this is a useful stop key.- Returns:
- true if this is a useful stop key
- See Also:
-
getStartOperator
Description copied from interface:RelationalOperatorGet the start operator for a scan (at the store level) for this RelationalOperator.- Specified by:
getStartOperatorin interfaceRelationalOperator- Overrides:
getStartOperatorin classUnaryComparisonOperatorNode- Parameters:
optTable- The optimizable table we're doing the scan on. This parameter is so we can tell which side of the operator the table's column is on.- Returns:
- Either ScanController.GT or ScanController.GE
- See Also:
-
getStopOperator
Description copied from interface:RelationalOperatorGet the stop operator for a scan (at the store level) for this RelationalOperator.- Specified by:
getStopOperatorin interfaceRelationalOperator- Overrides:
getStopOperatorin classUnaryComparisonOperatorNode- Parameters:
optTable- The optimizable table we're doing the scan on. This parameter is so we can tell which side of the operator the table's column is on.- Returns:
- Either ScanController.GT or ScanController.GE
- See Also:
-
generateOperator
Description copied from interface:RelationalOperatorGenerate the comparison operator for this RelationalOperator. The operator can depend on which side of this operator the optimizable column is.- Specified by:
generateOperatorin interfaceRelationalOperator- Parameters:
mb- The method the generated code is to go intooptTable- The optimizable table we're doing the scan on.- See Also:
-
generateNegate
Description copied from interface:RelationalOperatorGenerate an expression that evaluates to true if the result of the comparison should be negated. For example, col > 1 generates a comparison operator of <= and a negation of true, while col < 1 generates a comparison operator of < and a negation of false.- Specified by:
generateNegatein interfaceRelationalOperator- Parameters:
mb- The method the generated code is to go intooptTable- The Optimizable table the Qualifier will qualify- See Also:
-
getOperator
public int getOperator()Description copied from interface:RelationalOperatorReturn the operator (as an int) for this RelationalOperator.- Specified by:
getOperatorin interfaceRelationalOperator- Returns:
- int The operator for this RelationalOperator.
- See Also:
-
compareWithKnownConstant
Description copied from interface:RelationalOperatorReturn whether this operator compares the given Optimizable with a constant whose value is known at compile time.- Specified by:
compareWithKnownConstantin interfaceRelationalOperator- See Also:
-
getCompareValue
Description copied from interface:RelationalOperatorReturn an Object representing the known value that this relational operator is comparing to a column in the given Optimizable.- Specified by:
getCompareValuein interfaceRelationalOperator- Throws:
StandardException- Thrown on error- See Also:
-
equalsComparisonWithConstantExpression
Description copied from interface:RelationalOperatorReturn whether this operator is an equality comparison of the given optimizable with a constant expression.- Specified by:
equalsComparisonWithConstantExpressionin interfaceRelationalOperator- See Also:
-
getTransitiveSearchClause
public RelationalOperator getTransitiveSearchClause(ColumnReference otherCR) throws StandardException Description copied from interface:RelationalOperatorReturn a relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.- Specified by:
getTransitiveSearchClausein interfaceRelationalOperator- Parameters:
otherCR- The ColumnReference for the new (left) operand.- Returns:
- A relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.
- Throws:
StandardException- thrown on error- See Also:
-
getReceiverInterfaceName
String getReceiverInterfaceName()null operators are defined on DataValueDescriptor. Overrides method in UnaryOperatorNode for code generation purposes.- Overrides:
getReceiverInterfaceNamein classUnaryOperatorNode
-
selectivity
Description copied from class:ValueNodeThe default selectivity for value nodes is 50%. This is overridden in specific cases, such as the RelationalOperators.- Overrides:
selectivityin classValueNode
-
isNullNode
boolean isNullNode() -
isRelationalOperator
boolean isRelationalOperator()Description copied from class:ValueNodeReturns true if this ValueNode is a relational operator. Relational Operators are <, <=, =, >, >=, <> as well as IS NULL and IS NOT NULL. This is the preferred way of figuring out if a ValueNode is relational or not.- Overrides:
isRelationalOperatorin classValueNode- See Also:
-
optimizableEqualityNode
Description copied from class:ValueNodeReturn true if the predicate represents an optimizable equality node. an expression is considered to be an optimizable equality node if all the following conditions are met:- the operator is an = or IS NULL operator
- one of the operands is a column specified by optTable/columnNumber
- Both operands are not the same column; i.e tab.col = tab.col
- There are no implicit varchar comparisons of the operands; i.e either both operands are string like (varchar, char, longvarchar) or neither operand is string like
- Overrides:
optimizableEqualityNodein classValueNode- Parameters:
optTable- the table being optimized. Column reference must be from this table.columnNumber- the column number. One of the operands of this predicate must be the column number specified by optTable/columnNumberisNullOkay- if set to true we also consider IS NULL predicates; otherwise consider only = predicates.- See Also:
-