class BinaryRelationalOperatorNode extends BinaryComparisonOperatorNode implements RelationalOperator
Modifier and Type | Field and Description |
---|---|
private BaseTableNumbersVisitor |
btnVis |
private InListOperatorNode |
inListProbeSource |
(package private) static int |
K_EQUALS |
(package private) static int |
K_GREATER_EQUALS |
(package private) static int |
K_GREATER_THAN |
(package private) static int |
K_LESS_EQUALS |
(package private) static int |
K_LESS_THAN |
(package private) static int |
K_NOT_EQUALS |
(package private) int |
kind
This class is used to hold logically different objects for
space efficiency.
|
protected static int |
LEFT |
protected static int |
NEITHER |
(package private) JBitSet |
optBaseTables |
private int |
relOpType |
protected static int |
RIGHT |
(package private) JBitSet |
valNodeBaseTables |
AND, BinaryArgTypes, BinaryMethodNames, BinaryOperators, BinaryResultTypes, CONCATENATE, DIVIDE, EQ, GE, GT, K_BASE, K_XMLEXISTS, K_XMLQUERY, LE, leftInterfaceType, leftOperand, LIKE, LT, methodName, MINUS, NE, operator, OR, PLUS, receiver, resultInterfaceType, rightInterfaceType, rightOperand, TIMES
transformed
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
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 and Description |
---|
BinaryRelationalOperatorNode(int kind,
ValueNode leftOperand,
ValueNode rightOperand,
boolean forQueryRewrite,
ContextManager cm)
Constructor.
|
BinaryRelationalOperatorNode(int kind,
ValueNode leftOperand,
ValueNode rightOperand,
InListOperatorNode inListOp,
boolean forQueryRewrite,
ContextManager cm)
Same as constructor above except takes a third argument that is
an InListOperatorNode.
|
Modifier and Type | Method and Description |
---|---|
protected double |
booleanSelectivity(Optimizable optTable)
Return 50% if this is a comparison with a boolean column, a negative
selectivity otherwise.
|
private void |
buildTableNumList(Optimizable ft,
boolean forPush)
Create a set of table numbers to search when trying to find
which (if either) of this operator's operands reference the
received target table.
|
protected int |
columnOnOneSide(Optimizable optTable)
Determine whether there is a column from the given table on one side
of this operator, and if so, which side is it on?
|
boolean |
compareWithKnownConstant(Optimizable optTable,
boolean considerParameters)
Return whether this operator compares the given Optimizable with
a constant whose value is known at compile time.
|
private void |
constructorMinion() |
boolean |
equalsComparisonWithConstantExpression(Optimizable optTable)
Return whether this operator is an equality comparison of the given
optimizable with a constant expression.
|
(package private) ValueNode |
evaluateConstantExpressions()
See if the node always evaluates to true or false, and return a Boolean
constant node if it does.
|
void |
generateAbsoluteColumnId(MethodBuilder mb,
Optimizable optTable)
Generate the absolute column id for the ColumnReference that appears on one
side of this RelationalOperator or the other, and that refers to
the given table.
|
void |
generateExpressionOperand(Optimizable optTable,
int columnPosition,
ExpressionClassBuilderInterface acbi,
MethodBuilder mb)
Check whether this RelationalOperator is a comparison of the given
column with an expression.
|
void |
generateNegate(MethodBuilder mb,
Optimizable optTable)
Generate an expression that evaluates to true if the result of the
comparison should be negated.
|
void |
generateOperator(MethodBuilder mb,
Optimizable optTable)
Generate the comparison operator for this RelationalOperator.
|
void |
generateOrderedNulls(MethodBuilder mb)
Generate an expression that evaluates to true if this RelationalOperator
uses ordered null semantics, false if it doesn't.
|
void |
generateQualMethod(ExpressionClassBuilderInterface acbi,
MethodBuilder mb,
Optimizable optTable)
Generate the method to evaluate a Qualifier.
|
void |
generateRelativeColumnId(MethodBuilder mb,
Optimizable optTable)
Generate the relative column id for the ColumnReference that appears on one
side of this RelationalOperator or the other, and that refers to
the given table.
|
(package private) ValueNode |
genSQLJavaSQLTree()
generate a SQL->Java->SQL conversion tree above the left and right
operand of this Binary Operator Node if needed.
|
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)
Get the ColumnReference for the given table on one side of this
RelationalOperator.
|
ColumnReference |
getColumnOperand(Optimizable optTable,
int columnPosition)
Check whether this RelationalOperator is a comparison of the given
column with an expression.
|
DataValueDescriptor |
getCompareValue(Optimizable optTable)
Return an Object representing the known value that this relational
operator is comparing to a column in the given Optimizable.
|
ValueNode |
getExpressionOperand(int tableNumber,
int columnPosition,
Optimizable ft)
Check whether this RelationalOperator is a comparison of the given
column with an expression.
|
protected InListOperatorNode |
getInListOp()
If this rel op was created for an IN-list probe predicate then return
the underlying InListOperatorNode.
|
private int |
getKindForSwap()
Return the node type that must be used in order to construct an
equivalent expression if the operands are swapped.
|
private static java.lang.String |
getMethodName(int kind) |
(package private) BinaryOperatorNode |
getNegation(ValueNode leftOperand,
ValueNode rightOperand)
Returns the negation of this operator; negation of Equals is NotEquals.
|
private int |
getNegationNode() |
ValueNode |
getOperand(ColumnReference cRef,
int refSetSize,
boolean otherSide)
Find the operand (left or right) that points to the same table
as the received ColumnReference, and then return either that
operand or the "other" operand, depending on the value of
otherSide.
|
int |
getOperator()
Return the operator (as an int) for this RelationalOperator.
|
private static java.lang.String |
getOperatorName(int kind) |
int |
getOrderableVariantType(Optimizable optTable)
Return the variant type for the Qualifier's Orderable.
|
(package private) java.lang.String |
getReceiverInterfaceName()
The methods generated for this node all are on Orderable.
|
private int |
getRelOpType(int op) |
(package private) ValueNode |
getScopedOperand(int whichSide,
JBitSet parentRSNsTables,
ResultSetNode childRSN,
int[] whichRC)
Take a ResultSetNode and return a column reference that is scoped for
for the received ResultSetNode, where "scoped" means that the column
reference points to a specific column in the RSN.
|
int |
getStartOperator(Optimizable optTable)
Get the start operator for a scan (at the store level) for this
RelationalOperator.
|
int |
getStopOperator(Optimizable optTable)
Get the stop operator for a scan (at the store level) for this
RelationalOperator.
|
(package private) BinaryOperatorNode |
getSwappedEquivalent()
Return an equivalent node with the operands swapped, and possibly with
the operator type changed in order to preserve the meaning of the
expression.
|
RelationalOperator |
getTransitiveSearchClause(ColumnReference otherCR)
Return a relational operator which matches the current one
but with the passed in ColumnReference as the (left) operand.
|
private boolean |
implicitVarcharComparison()
Return whether or not this binary relational predicate requires an implicit
(var)char conversion.
|
private void |
initBaseTableVisitor(int numTablesInQuery,
boolean initOptBaseTables)
Initialize the fields used for retrieving base tables in
subtrees, which allows us to do a more extensive search
for table references.
|
(package private) boolean |
isBinaryEqualsOperatorNode()
Returns true if this value node is a equals operator.
|
(package private) boolean |
isInListProbeNode()
Returns true if this value node is an operator created
for optimized performance of an IN list.
|
boolean |
isQualifier(Optimizable optTable,
boolean forPush)
Return true if this operator can be compiled into a Qualifier for
the given Optimizable table.
|
(package private) boolean |
isRelationalOperator()
Returns true if this ValueNode is a relational operator.
|
(package private) boolean |
isSameNodeKind(ValueNode o)
Some node classes represent several logical node types (to reduce
footprint), which we call kinds.
|
protected boolean |
keyColumnOnLeft(Optimizable optTable)
Return true if a key column for the given table is found on the
left side of this operator, false if it is found on the right
side of this operator.
|
private ValueNode |
newBool(boolean b)
Create a Boolean constant node with a specified value.
|
(package private) boolean |
optimizableEqualityNode(Optimizable optTable,
int columnNumber,
boolean isNullOkay)
Return true if the predicate represents an optimizable equality node.
|
boolean |
orderedNulls()
Return true if this operator uses ordered null semantics
|
double |
selectivity(Optimizable optTable)
return the selectivity of this predicate.
|
boolean |
selfComparison(ColumnReference cr)
Check whether this RelationalOperator compares the given ColumnReference
to any columns in the same table as the ColumnReference.
|
protected boolean |
usefulStartKey(boolean columnOnLeft)
is this is useful start key?
|
boolean |
usefulStartKey(Optimizable optTable)
Tell whether this relop is a useful start key for the given table.
|
protected boolean |
usefulStopKey(boolean columnOnLeft) |
boolean |
usefulStopKey(Optimizable optTable)
Tell whether this relop is a useful stop key for the given table.
|
private boolean |
valNodeReferencesOptTable(ValueNode valNode,
Optimizable optTable,
boolean forPush,
boolean walkOptTableSubtree)
Determine whether or not the received ValueNode (which will
usually be a ColumnReference) references either the received
optTable or else a base table in the subtree beneath that
optTable.
|
bindComparisonOperator, bindExpression, changeToCNF, eliminateNots, getBetweenSelectivity, getForQueryRewrite, preprocess, setBetweenSelectivity, setForQueryRewrite
acceptChildren, bindXMLQuery, categorize, constantExpression, generateExpression, getLeftOperand, getOrderableVariantType, getRightOperand, isConstantExpression, isEquivalent, printSubNodes, remapColumnReferencesToExpressions, setLeftOperand, setLeftRightInterfaceType, setMethodName, setOperator, setRightOperand, toString
pushSqlXmlUtil
bindExpression, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, genEqualsFalseTree, generate, genIsNullTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, isBooleanFalse, isBooleanTrue, isCloneable, isParameterNode, putAndsOnTop, requiresTypeFromContext, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
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
static final int K_EQUALS
static final int K_GREATER_EQUALS
static final int K_GREATER_THAN
static final int K_LESS_EQUALS
static final int K_LESS_THAN
static final int K_NOT_EQUALS
final int kind
kind
represents the logical object
type. See also ValueNode.isSameNodeKind(org.apache.derby.impl.sql.compile.ValueNode)
.private int relOpType
private BaseTableNumbersVisitor btnVis
JBitSet optBaseTables
JBitSet valNodeBaseTables
private InListOperatorNode inListProbeSource
protected static final int LEFT
protected static final int NEITHER
protected static final int RIGHT
BinaryRelationalOperatorNode(int kind, ValueNode leftOperand, ValueNode rightOperand, boolean forQueryRewrite, ContextManager cm) throws StandardException
"where name LIKE
'Col1' ESCAPE '\' "
failed.
Argument forQueryRewrite
can be true only if this node has been
added by an internal rewrite of the query. This allows binding to
be more liberal when checking it against allowed syntax.
This parameter will be passed FALSE when a new instance of the node
is being created(which is the majority of the cases). But when an
existing node is getting cloned, the value of this parameter should
be passed as the originalNode.getForQueryRewrite(). Examples of this
can be found in Predicate.Java and PredicateList.javakind
- The kind of operatorleftOperand
- The left operandrightOperand
- The right operandforQueryRewrite
- See method descriptioncm
- The context managerStandardException
BinaryRelationalOperatorNode(int kind, ValueNode leftOperand, ValueNode rightOperand, InListOperatorNode inListOp, boolean forQueryRewrite, ContextManager cm) throws StandardException
StandardException
private void constructorMinion()
private static java.lang.String getMethodName(int kind)
private static java.lang.String getOperatorName(int kind)
private int getRelOpType(int op)
protected InListOperatorNode getInListOp()
public ColumnReference getColumnOperand(Optimizable optTable, int columnPosition)
RelationalOperator
getColumnOperand
in interface RelationalOperator
optTable
- An Optimizable for the base table the column is incolumnPosition
- The ordinal position of the column (one-based)RelationalOperator.getColumnOperand(org.apache.derby.iapi.sql.compile.Optimizable, int)
public ColumnReference getColumnOperand(Optimizable optTable)
RelationalOperator
getColumnOperand
in interface RelationalOperator
RelationalOperator.getColumnOperand(org.apache.derby.iapi.sql.compile.Optimizable, int)
public ValueNode getExpressionOperand(int tableNumber, int columnPosition, Optimizable ft)
RelationalOperator
getExpressionOperand
in interface RelationalOperator
tableNumber
- The table number of the base table the column is incolumnPosition
- The ordinal position of the column (one-based)ft
- We'll look for the column in all tables at and beneath ft.
This is useful if ft is, say, a ProjectRestrictNode over a subquery--
then we want to look at all of the FROM tables in the subquery to try
to find the right column.RelationalOperator.getExpressionOperand(int, int, org.apache.derby.iapi.sql.compile.Optimizable)
public ValueNode getOperand(ColumnReference cRef, int refSetSize, boolean otherSide)
RelationalOperator
getOperand
in interface RelationalOperator
cRef
- The ColumnReference for which we're searching.refSetSize
- Size of the referenced map for the predicate
represented by this RelationalOperator node. This is used
for storing base table numbers when searching for cRef.otherSide
- Assuming we find an operand that points to
the same table as cRef, then we will return the *other*
operand if otherSide is true; else we'll return the operand
that matches cRef.RelationalOperator.getOperand(org.apache.derby.impl.sql.compile.ColumnReference, int, boolean)
public void generateExpressionOperand(Optimizable optTable, int columnPosition, ExpressionClassBuilderInterface acbi, MethodBuilder mb) throws StandardException
RelationalOperator
generateExpressionOperand
in interface RelationalOperator
optTable
- An Optimizable for the base table the column is incolumnPosition
- The ordinal position of the column (one-based)acbi
- The ExpressionClassBuilder for the class we're buildingmb
- The method the expression will go intoStandardException
- Thrown on errorRelationalOperator.generateExpressionOperand(org.apache.derby.iapi.sql.compile.Optimizable, int, org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface, org.apache.derby.iapi.services.compiler.MethodBuilder)
public boolean selfComparison(ColumnReference cr) throws StandardException
RelationalOperator
selfComparison
in interface RelationalOperator
cr
- The ColumnReference that is being compared to some
expression.StandardException
- Thrown on errorRelationalOperator.selfComparison(org.apache.derby.impl.sql.compile.ColumnReference)
public boolean usefulStartKey(Optimizable optTable)
RelationalOperator
usefulStartKey
in interface RelationalOperator
optTable
- The Optimizable table for which we want to know
whether this is a useful start key.RelationalOperator.usefulStartKey(org.apache.derby.iapi.sql.compile.Optimizable)
protected boolean keyColumnOnLeft(Optimizable optTable)
optTable
- The Optimizable table that we're looking for a key
column on.protected int columnOnOneSide(Optimizable optTable)
optTable
- The Optimizable table that we're looking for a key
column on.public boolean usefulStopKey(Optimizable optTable)
RelationalOperator
usefulStopKey
in interface RelationalOperator
optTable
- The Optimizable table for which we want to know
whether this is a useful stop key.RelationalOperator.usefulStopKey(org.apache.derby.iapi.sql.compile.Optimizable)
public void generateAbsoluteColumnId(MethodBuilder mb, Optimizable optTable)
RelationalOperator
generateAbsoluteColumnId
in interface RelationalOperator
mb
- The method the generated code is to go intooptTable
- The optimizable table we're doing the scan on.RelationalOperator.generateAbsoluteColumnId(org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.sql.compile.Optimizable)
public void generateRelativeColumnId(MethodBuilder mb, Optimizable optTable)
RelationalOperator
generateRelativeColumnId
in interface RelationalOperator
mb
- The method the generated code is to go intooptTable
- The optimizable table we're doing the scan on.RelationalOperator.generateRelativeColumnId(org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.sql.compile.Optimizable)
private int getAbsoluteColumnPosition(Optimizable optTable)
optTable
- The Optimizablepublic void generateQualMethod(ExpressionClassBuilderInterface acbi, MethodBuilder mb, Optimizable optTable) throws StandardException
RelationalOperator
generateQualMethod
in interface RelationalOperator
acbi
- The ExpressionClassBuilder for the class we're buildingmb
- The method the generated code is to go intooptTable
- The Optimizable table the Qualifier will qualifyStandardException
- Thrown on errorpublic void generateOrderedNulls(MethodBuilder mb)
RelationalOperator
generateOrderedNulls
in interface RelationalOperator
mb
- The method the generated code is to go intoRelationalOperator.generateOrderedNulls(org.apache.derby.iapi.services.compiler.MethodBuilder)
public boolean orderedNulls()
RelationalOperator
orderedNulls
in interface RelationalOperator
RelationalOperator.orderedNulls()
public boolean isQualifier(Optimizable optTable, boolean forPush) throws StandardException
RelationalOperator
isQualifier
in interface RelationalOperator
optTable
- The Optimizable table in question.forPush
- Are we asking because we're trying to push?StandardException
- Thrown on errorRelationalOperator.isQualifier(org.apache.derby.iapi.sql.compile.Optimizable, boolean)
public int getOrderableVariantType(Optimizable optTable) throws StandardException
RelationalOperator
getOrderableVariantType
in interface RelationalOperator
optTable
- The Optimizable table the Qualifier will qualifyStandardException
- thrown on errorRelationalOperator.getOrderableVariantType(org.apache.derby.iapi.sql.compile.Optimizable)
public boolean compareWithKnownConstant(Optimizable optTable, boolean considerParameters)
RelationalOperator
compareWithKnownConstant
in interface RelationalOperator
RelationalOperator.compareWithKnownConstant(org.apache.derby.iapi.sql.compile.Optimizable, boolean)
public DataValueDescriptor getCompareValue(Optimizable optTable) throws StandardException
RelationalOperator
getCompareValue
in interface RelationalOperator
StandardException
- Thrown on errorRelationalOperator.getCompareValue(org.apache.derby.iapi.sql.compile.Optimizable)
protected double booleanSelectivity(Optimizable optTable) throws StandardException
StandardException
java.lang.String getReceiverInterfaceName()
getReceiverInterfaceName
in class BinaryOperatorNode
ValueNode evaluateConstantExpressions() throws StandardException
evaluateConstantExpressions
in class ValueNode
StandardException
- if an error occurs during evaluationConstantExpressionVisitor
private ValueNode newBool(boolean b) throws StandardException
b
- the value of the constantStandardException
BinaryOperatorNode getNegation(ValueNode leftOperand, ValueNode rightOperand) throws StandardException
getNegation
in class BinaryComparisonOperatorNode
leftOperand
- The left operand of the comparison operatorrightOperand
- The right operand of the comparison operatorStandardException
- Thrown on errorprivate int getNegationNode()
BinaryOperatorNode getSwappedEquivalent() throws StandardException
getSwappedEquivalent
in class BinaryComparisonOperatorNode
StandardException
- if an error occursprivate int getKindForSwap()
=
and <>
), the same node type is returned.
Otherwise, the direction of the operator is switched in order to
preserve the meaning (for instance, a node representing less-than will
return the node type for greater-than).protected boolean usefulStartKey(boolean columnOnLeft)
columnOnLeft
- is true if the column is the left hand side of the
binary operator.protected boolean usefulStopKey(boolean columnOnLeft)
public int getStartOperator(Optimizable optTable)
RelationalOperator
getStartOperator
in interface RelationalOperator
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.RelationalOperator.getStartOperator(org.apache.derby.iapi.sql.compile.Optimizable)
public int getStopOperator(Optimizable optTable)
RelationalOperator
getStopOperator
in interface RelationalOperator
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.RelationalOperator.getStopOperator(org.apache.derby.iapi.sql.compile.Optimizable)
public void generateOperator(MethodBuilder mb, Optimizable optTable)
RelationalOperator
generateOperator
in interface RelationalOperator
mb
- The method the generated code is to go intooptTable
- The optimizable table we're doing the scan on.RelationalOperator.generateOperator(org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.sql.compile.Optimizable)
public void generateNegate(MethodBuilder mb, Optimizable optTable)
RelationalOperator
generateNegate
in interface RelationalOperator
mb
- The method the generated code is to go intooptTable
- The Optimizable table the Qualifier will qualifyRelationalOperator.generateNegate(org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.sql.compile.Optimizable)
public int getOperator()
RelationalOperator
getOperator
in interface RelationalOperator
RelationalOperator.getOperator()
public double selectivity(Optimizable optTable) throws StandardException
selectivity
in class ValueNode
StandardException
public RelationalOperator getTransitiveSearchClause(ColumnReference otherCR) throws StandardException
RelationalOperator
getTransitiveSearchClause
in interface RelationalOperator
otherCR
- The ColumnReference for the new (left) operand.StandardException
- Thrown on errorRelationalOperator.getTransitiveSearchClause(org.apache.derby.impl.sql.compile.ColumnReference)
public boolean equalsComparisonWithConstantExpression(Optimizable optTable)
RelationalOperator
equalsComparisonWithConstantExpression
in interface RelationalOperator
boolean isRelationalOperator()
ValueNode
isRelationalOperator
in class ValueNode
ValueNode.isRelationalOperator()
boolean isBinaryEqualsOperatorNode()
ValueNode
isBinaryEqualsOperatorNode
in class ValueNode
ValueNode.isBinaryEqualsOperatorNode()
boolean isInListProbeNode()
ValueNode
isInListProbeNode
in class ValueNode
It's okay for this method to reference inListProbeSource directly
because it does not rely on the contents of inListProbeSource's
leftOperand, and a caller of this method cannot gain access to
inListProbeSource's leftOperand through this method.
boolean optimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay) throws StandardException
ValueNode
optimizableEqualityNode
in class ValueNode
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.StandardException
ValueNode.optimizableEqualityNode(org.apache.derby.iapi.sql.compile.Optimizable, int, boolean)
private boolean implicitVarcharComparison() throws StandardException
StandardException
- Thrown on errorValueNode genSQLJavaSQLTree() throws StandardException
BinaryOperatorNode
genSQLJavaSQLTree
in class BinaryComparisonOperatorNode
StandardException
- Thrown on errorBinaryOperatorNode.genSQLJavaSQLTree()
ValueNode getScopedOperand(int whichSide, JBitSet parentRSNsTables, ResultSetNode childRSN, int[] whichRC) throws StandardException
whichSide
- The operand are we trying to scope (LEFT or RIGHT)parentRSNsTables
- Set of all table numbers referenced by
the ResultSetNode that is _parent_ to the received childRSN.
We need this to make sure we don't scope the operand to a
ResultSetNode to which it doesn't apply.childRSN
- The result set node to which we want to create
a scoped predicate.whichRC
- If not -1 then this tells us which ResultColumn
in the received childRSN we need to use for the scoped predicate;
if -1 then the column position of the scoped column reference
will be stored in this array and passed back to the caller.StandardException
private boolean valNodeReferencesOptTable(ValueNode valNode, Optimizable optTable, boolean forPush, boolean walkOptTableSubtree)
valNode
- The ValueNode that has the reference(s).optTable
- The table/subtree node to which we're trying
to find a reference.forPush
- Whether or not we are searching with the intent
to push this operator to the target table.walkOptTableSubtree
- Should we walk the subtree beneath
optTable to find base tables, or not? Will be false if we've
already done it for the left operand and now we're here
for the right operand.private void initBaseTableVisitor(int numTablesInQuery, boolean initOptBaseTables)
numTablesInQuery
- Used for creating JBitSets that
can hold table numbers for the query.initOptBaseTables
- Whether or not we should clear out
or initialize the optBaseTables bit set.private void buildTableNumList(Optimizable ft, boolean forPush) throws StandardException
ft
- Target table for which we're building the search
list.forPush
- Whether or not we are searching with the intent
to push this operator to the target table.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 BinaryOperatorNode
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.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.