Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

public final Class IsNullNode

extends UnaryComparisonOperatorNode
implements RelationalOperator
Class Inheritance
All Implemented Interfaces
org.apache.derby.impl.sql.compile.RelationalOperator
Imports
java.sql.Types, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.store.access.ScanController, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor, .Orderable, .TypeId

This node represents either a unary IS NULL or IS NOT NULL comparison operator

Field Summary

Modifier and TypeField and Description
private boolean
notNull

If true, this node represents a NOT NULL node rather than a NULL node.

private DataValueDescriptor

Constructor Summary

AccessConstructor and Description
pack-priv
IsNullNode(ValueNode operand, boolean notNull, ContextManager cm)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public boolean
compareWithKnownConstant(Optimizable optTable, boolean considerParameters)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.compareWithKnownConstant.

Return whether this operator compares the given Optimizable with a constant whose value is known at compile time.

public boolean
equalsComparisonWithConstantExpression(Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.equalsComparisonWithConstantExpression.

Return whether this operator is an equality comparison of the given optimizable with a constant expression.

public void
generateNegate(MethodBuilder
The method the generated code is to go into
mb
,
Optimizable
The Optimizable table the Qualifier will qualify
optTable
)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.generateNegate.

Generate an expression that evaluates to true if the result of the comparison should be negated.

public void
generateOperator(MethodBuilder
The method the generated code is to go into
mb
,
Optimizable
The optimizable table we're doing the scan on.
optTable
)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.generateOperator.

Generate the comparison operator for this RelationalOperator.

public DataValueDescriptor
getCompareValue(Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getCompareValue.

Return an Object representing the known value that this relational operator is comparing to a column in the given Optimizable.

pack-priv UnaryOperatorNode

Returns:

UnaryOperatorNode The negated expression
getNegation
(ValueNode
The operand of the operator
operand
)

Implements abstract org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getNegation.

Negate the comparison.

public int
getOperator()

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getOperator.

Return the operator (as an int) for this RelationalOperator.

pack-priv String
public int
getStartOperator(Optimizable
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.
optTable
)

Overrides org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getStartOperator.

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getStartOperator.

Get the start operator for a scan (at the store level) for this RelationalOperator.

public int
getStopOperator(Optimizable
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.
optTable
)

Overrides org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getStopOperator.

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getStopOperator.

Get the stop operator for a scan (at the store level) for this RelationalOperator.

public RelationalOperator
getTransitiveSearchClause(ColumnReference
The ColumnReference for the new (left) operand.
otherCR
)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getTransitiveSearchClause.

Return a relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.

pack-priv boolean
pack-priv boolean
isRelationalOperator()

Overrides org.apache.derby.impl.sql.compile.ValueNode.isRelationalOperator.

Returns true if this ValueNode is a relational operator.

pack-priv boolean
optimizableEqualityNode(Optimizable
the table being optimized. Column reference must be from this table.
optTable
,
int
the column number. One of the operands of this predicate must be the column number specified by optTable/columnNumber
columnNumber
,
boolean
if set to true we also consider IS NULL predicates; otherwise consider only = predicates.
isNullOkay
)

Overrides org.apache.derby.impl.sql.compile.ValueNode.optimizableEqualityNode.

Return true if the predicate represents an optimizable equality node.

public double
selectivity(Optimizable optTable)

Overrides org.apache.derby.impl.sql.compile.ValueNode.selectivity.

The default selectivity for value nodes is 50%.

private void
public boolean
usefulStartKey(Optimizable
The Optimizable table for which we want to know whether this is a useful start key.
optTable
)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.usefulStartKey.

Tell whether this relop is a useful start key for the given table.

public boolean
usefulStopKey(Optimizable
The Optimizable table for which we want to know whether this is a useful stop key.
optTable
)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.usefulStopKey.

Tell whether this relop is a useful stop key for the given table.

Inherited from org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode:
bindComparisonOperatorbindExpressioneliminateNotsgenerateAbsoluteColumnIdgenerateExpressionOperandgenerateOrderedNullsgenerateQualMethodgenerateRelativeColumnIdgetColumnOperandgetColumnOperandgetExpressionOperandgetOperandgetOrderableVariantTypeisQualifierorderedNullsselfComparison

Field Detail

notNullback to summary
private boolean notNull

If true, this node represents a NOT NULL node rather than a NULL node. Note that this state is mutable, cf getNegation.

nullValueback to summary
private DataValueDescriptor nullValue

Constructor Detail

IsNullNodeback to summary
pack-priv IsNullNode(ValueNode operand, boolean notNull, ContextManager cm) throws StandardException

Method Detail

bindParameterback to summary
pack-priv void bindParameter() throws StandardException

Overrides org.apache.derby.impl.sql.compile.UnaryOperatorNode.bindParameter.

Bind a ? parameter operand of the IS [NOT] NULL predicate.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
compareWithKnownConstantback to summary
public boolean compareWithKnownConstant(Optimizable optTable, boolean considerParameters)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.compareWithKnownConstant.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.compareWithKnownConstant.

Return whether this operator compares the given Optimizable with a constant whose value is known at compile time.

See Also
RelationalOperator#compareWithKnownConstant
equalsComparisonWithConstantExpressionback to summary
public boolean equalsComparisonWithConstantExpression(Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.equalsComparisonWithConstantExpression.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.equalsComparisonWithConstantExpression.

Return whether this operator is an equality comparison of the given optimizable with a constant expression.

See Also
RelationalOperator#equalsComparisonWithConstantExpression
generateNegateback to summary
public void generateNegate(MethodBuilder mb, Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.generateNegate.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.generateNegate.

Generate 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.

Parameters
mb:MethodBuilder

The method the generated code is to go into

optTable:Optimizable

The Optimizable table the Qualifier will qualify

See Also
RelationalOperator#generateNegate
generateOperatorback to summary
public void generateOperator(MethodBuilder mb, Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.generateOperator.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.generateOperator.

Generate the comparison operator for this RelationalOperator. The operator can depend on which side of this operator the optimizable column is.

Parameters
mb:MethodBuilder

The method the generated code is to go into

optTable:Optimizable

The optimizable table we're doing the scan on.

See Also
RelationalOperator#generateOperator
getCompareValueback to summary
public DataValueDescriptor getCompareValue(Optimizable optTable) throws StandardException

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getCompareValue.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.getCompareValue.

Return an Object representing the known value that this relational operator is comparing to a column in the given Optimizable.

Exceptions
StandardException:
Thrown on error
See Also
RelationalOperator#getCompareValue
getNegationback to summary
pack-priv UnaryOperatorNode getNegation(ValueNode operand) throws StandardException

Implements abstract org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getNegation.

Negate the comparison.

Parameters
operand:ValueNode

The operand of the operator

Returns:UnaryOperatorNode

UnaryOperatorNode The negated expression

Exceptions
StandardException:
Thrown on error
getOperatorback to summary
public int getOperator()

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getOperator.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.getOperator.

Return the operator (as an int) for this RelationalOperator.

Returns:int

int The operator for this RelationalOperator.

See Also
RelationalOperator#getOperator
getReceiverInterfaceNameback to summary
pack-priv String getReceiverInterfaceName()

Overrides org.apache.derby.impl.sql.compile.UnaryOperatorNode.getReceiverInterfaceName.

null operators are defined on DataValueDescriptor. Overrides method in UnaryOperatorNode for code generation purposes.

Annotations
@Override
getStartOperatorback to summary
public int getStartOperator(Optimizable optTable)

Overrides org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getStartOperator.

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getStartOperator.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.getStartOperator.

Get the start operator for a scan (at the store level) for this RelationalOperator.

Parameters
optTable:Optimizable

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:int

Either ScanController.GT or ScanController.GE

Annotations
@Override
See Also
RelationalOperator#getStartOperator
getStopOperatorback to summary
public int getStopOperator(Optimizable optTable)

Overrides org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode.getStopOperator.

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getStopOperator.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.getStopOperator.

Get the stop operator for a scan (at the store level) for this RelationalOperator.

Parameters
optTable:Optimizable

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:int

Either ScanController.GT or ScanController.GE

Annotations
@Override
See Also
RelationalOperator#getStopOperator
getTransitiveSearchClauseback to summary
public RelationalOperator getTransitiveSearchClause(ColumnReference otherCR) throws StandardException

Implements org.apache.derby.impl.sql.compile.RelationalOperator.getTransitiveSearchClause.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.getTransitiveSearchClause.

Return a relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.

Parameters
otherCR:ColumnReference

The ColumnReference for the new (left) operand.

Returns:RelationalOperator

A relational operator which matches the current one but with the passed in ColumnReference as the (left) operand.

Exceptions
StandardException:
thrown on error
See Also
RelationalOperator#getTransitiveSearchClause
isNullNodeback to summary
pack-priv boolean isNullNode()
isRelationalOperatorback to summary
pack-priv boolean isRelationalOperator()

Overrides org.apache.derby.impl.sql.compile.ValueNode.isRelationalOperator.

Doc from org.apache.derby.impl.sql.compile.ValueNode.isRelationalOperator.

Returns 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.

Annotations
@Override
See Also
ValueNode#isRelationalOperator
optimizableEqualityNodeback to summary
pack-priv boolean optimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay)

Overrides org.apache.derby.impl.sql.compile.ValueNode.optimizableEqualityNode.

Doc from org.apache.derby.impl.sql.compile.ValueNode.optimizableEqualityNode.

Return 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:

  1. the operator is an = or IS NULL operator
  2. one of the operands is a column specified by optTable/columnNumber
  3. Both operands are not the same column; i.e tab.col = tab.col
  4. 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
Parameters
optTable:Optimizable

the table being optimized. Column reference must be from this table.

columnNumber:int

the column number. One of the operands of this predicate must be the column number specified by optTable/columnNumber

isNullOkay:boolean

if set to true we also consider IS NULL predicates; otherwise consider only = predicates.

Annotations
@Override
See Also
ValueNode#optimizableEqualityNode
selectivityback to summary
public double selectivity(Optimizable optTable)

Overrides org.apache.derby.impl.sql.compile.ValueNode.selectivity.

Doc from org.apache.derby.impl.sql.compile.ValueNode.selectivity.

The default selectivity for value nodes is 50%. This is overridden in specific cases, such as the RelationalOperators.

Annotations
@Override
updateOperatorDetailsback to summary
private void updateOperatorDetails()
usefulStartKeyback to summary
public boolean usefulStartKey(Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.usefulStartKey.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.usefulStartKey.

Tell 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.

Parameters
optTable:Optimizable

The Optimizable table for which we want to know whether this is a useful start key.

Returns:boolean

true if this is a useful start key

See Also
RelationalOperator#usefulStartKey
usefulStopKeyback to summary
public boolean usefulStopKey(Optimizable optTable)

Implements org.apache.derby.impl.sql.compile.RelationalOperator.usefulStopKey.

Doc from org.apache.derby.impl.sql.compile.RelationalOperator.usefulStopKey.

Tell 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.

Parameters
optTable:Optimizable

The Optimizable table for which we want to know whether this is a useful stop key.

Returns:boolean

true if this is a useful stop key

See Also
RelationalOperator#usefulStopKey