|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.Predicate
A Predicate represents a top level predicate.
Field Summary | |
(package private) AndNode |
andNode
|
(package private) int |
equivalenceClass
|
(package private) int |
indexPosition
|
protected boolean |
isQualifier
|
(package private) boolean |
pushable
|
(package private) JBitSet |
referencedSet
|
private java.util.Hashtable |
searchClauseHT
|
protected boolean |
startKey
|
protected boolean |
stopKey
|
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
Constructor Summary | |
Predicate()
|
Method Summary | |
Visitable |
accept(Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
void |
categorize()
Categorize this predicate. |
(package private) void |
clearQualifierFlag()
Clear the qualifier flag. |
(package private) void |
clearScanFlags()
Clear the start/stop position and qualifier flags |
int |
compareTo(java.lang.Object other)
|
boolean |
compareWithKnownConstant(Optimizable optTable,
boolean considerParameters)
Is this predicate a comparison with a known constant value? |
void |
copyFields(Predicate otherPred)
Copy all fields of this Predicate (except the two that are set from 'init'). |
boolean |
equalsComparisonWithConstantExpression(Optimizable optTable)
Is this predicate an equality comparison with a constant expression? |
(package private) void |
generateAbsoluteColumnId(MethodBuilder mb,
Optimizable optTable)
|
(package private) void |
generateExpressionOperand(Optimizable optTable,
int columnPosition,
ExpressionClassBuilder acb,
MethodBuilder mb)
|
(package private) void |
generateNegate(MethodBuilder mb,
Optimizable optTable)
|
(package private) void |
generateOperator(MethodBuilder mb,
Optimizable optTable)
|
(package private) void |
generateOrderableVariantType(MethodBuilder mb,
Optimizable optTable)
|
(package private) void |
generateOrderedNulls(MethodBuilder mb)
|
(package private) void |
generateQualMethod(ExpressionClassBuilder acb,
MethodBuilder mb,
Optimizable optTable)
|
(package private) void |
generateRelativeColumnId(MethodBuilder mb,
Optimizable optTable)
|
AndNode |
getAndNode()
Return the andNode. |
DataValueDescriptor |
getCompareValue(Optimizable optTable)
Get an Object representing the known constant value that the given Optimizable is being compared to. |
(package private) int |
getEquivalenceClass()
Get the equivalenceClass for this predicate. |
int |
getIndexPosition()
Get the position of the index column that this predicate restricts. |
boolean |
getPushable()
Return the pushable. |
JBitSet |
getReferencedMap()
Get the map of referenced tables for this OptimizablePredicate. |
JBitSet |
getReferencedSet()
Return the referencedSet. |
RelationalOperator |
getRelop()
Get the RelationalOperator on the left side of the AND node, if there is one. |
java.util.Hashtable |
getSearchClauseHT()
Get the search clause Hash Table. |
(package private) int |
getStartOperator(Optimizable optTable)
Get the start operator for this predicate for a scan. |
(package private) int |
getStopOperator(Optimizable optTable)
|
int |
hasEqualOnColumnList(int[] baseColumnPositions,
Optimizable optTable)
Returns if the predicate involves an equal operator on one of the columns specified in the baseColumnPositions. |
boolean |
hasMethodCall()
Return whether or not an OptimizablePredicate contains a method call. |
boolean |
hasSubquery()
Return whether or not an OptimizablePredicate contains a subquery. |
void |
init(java.lang.Object andNode,
java.lang.Object referencedSet)
Initializer. |
boolean |
isOrList()
|
boolean |
isPushableOrClause(Optimizable optTable)
Is this predicate an pushable OR list? |
boolean |
isQualifier()
Is this predicate a qualifier? |
boolean |
isStartKey()
Is this predicate a start key? |
boolean |
isStopKey()
Is this predicate a stop key? |
boolean |
isStoreQualifier()
Is this predicate a possible Qualifier for store? |
void |
markQualifier()
Tell the predicate that it is to be used as a qualifier in an index scan. |
void |
markStartKey()
Tell the predicate that it is to be used as a column in the start key value for an index scan. |
void |
markStopKey()
Tell the predicate that it is to be used as a column in the stop key value for an index scan. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
double |
selectivity(Optimizable optTable)
Get a (crude) estimate of the selectivity of this predicate. |
void |
setAndNode(AndNode andNode)
Set the andNode. |
(package private) void |
setEquivalenceClass(int equivalenceClass)
Set the equivalence class, if any, for this predicate. |
(package private) void |
setIndexPosition(int indexPosition)
Set the position of the index column that this predicate restricts |
(package private) void |
setTransitiveSearchClauseAdded(RelationalOperator ro)
Mark this predicate as having been used to add a new predicate of the specified type via transitive closure on search clauses. |
java.lang.String |
toString()
Convert this object to a String. |
(package private) boolean |
transitiveSearchClauseAdded(RelationalOperator ro)
Return whether or not this predicate has been used to add a new search clause of the specified type via transitive closure. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
AndNode andNode
boolean pushable
JBitSet referencedSet
int equivalenceClass
int indexPosition
protected boolean startKey
protected boolean stopKey
protected boolean isQualifier
private java.util.Hashtable searchClauseHT
Constructor Detail |
public Predicate()
Method Detail |
public void init(java.lang.Object andNode, java.lang.Object referencedSet)
init
in class QueryTreeNode
andNode
- The top of the predicatereferencedSet
- Bit map of referenced tablespublic JBitSet getReferencedMap()
OptimizablePredicate
getReferencedMap
in interface OptimizablePredicate
OptimizablePredicate.getReferencedMap()
public boolean hasSubquery()
OptimizablePredicate
hasSubquery
in interface OptimizablePredicate
OptimizablePredicate.hasSubquery()
public boolean hasMethodCall()
OptimizablePredicate
hasMethodCall
in interface OptimizablePredicate
OptimizablePredicate.hasMethodCall()
public void markStartKey()
OptimizablePredicate
markStartKey
in interface OptimizablePredicate
OptimizablePredicate.markStartKey()
public boolean isStartKey()
OptimizablePredicate
isStartKey
in interface OptimizablePredicate
OptimizablePredicate.isStartKey()
public void markStopKey()
OptimizablePredicate
markStopKey
in interface OptimizablePredicate
OptimizablePredicate.markStopKey()
public boolean isStopKey()
OptimizablePredicate
isStopKey
in interface OptimizablePredicate
OptimizablePredicate.isStopKey()
public void markQualifier()
OptimizablePredicate
markQualifier
in interface OptimizablePredicate
OptimizablePredicate.markQualifier()
public boolean isQualifier()
OptimizablePredicate
isQualifier
in interface OptimizablePredicate
OptimizablePredicate.isQualifier()
public boolean compareWithKnownConstant(Optimizable optTable, boolean considerParameters)
OptimizablePredicate
compareWithKnownConstant
in interface OptimizablePredicate
optTable
- The Optimizable that we want to know whether we
are comparing to a known constant.considerParameters
- Whether or not to consider parameters with defaults
as known constants.OptimizablePredicate.compareWithKnownConstant(org.apache.derby.iapi.sql.compile.Optimizable, boolean)
public int hasEqualOnColumnList(int[] baseColumnPositions, Optimizable optTable) throws StandardException
OptimizablePredicate
hasEqualOnColumnList
in interface OptimizablePredicate
baseColumnPositions
- the column numbers on which the user wants
to check if the equality condition exists.optTable
- the table for which baseColumnPositions are given.
StandardException
public DataValueDescriptor getCompareValue(Optimizable optTable) throws StandardException
OptimizablePredicate
getCompareValue
in interface OptimizablePredicate
StandardException
- Thrown on errorOptimizablePredicate.getCompareValue(org.apache.derby.iapi.sql.compile.Optimizable)
public boolean equalsComparisonWithConstantExpression(Optimizable optTable)
OptimizablePredicate
equalsComparisonWithConstantExpression
in interface OptimizablePredicate
optTable
- The Optimizable for which we want to know whether
it is being equality-compared to a constant expression.OptimizablePredicate.equalsComparisonWithConstantExpression(org.apache.derby.iapi.sql.compile.Optimizable)
public double selectivity(Optimizable optTable)
OptimizablePredicate
selectivity
in interface OptimizablePredicate
optTable
- The Optimizable that this predicate restrictsOptimizablePredicate.selectivity(org.apache.derby.iapi.sql.compile.Optimizable)
public int getIndexPosition()
OptimizablePredicate
getIndexPosition
in interface OptimizablePredicate
OptimizablePredicate.getIndexPosition()
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public AndNode getAndNode()
public void setAndNode(AndNode andNode)
andNode
- The new andNode.
public boolean getPushable()
public JBitSet getReferencedSet()
void setEquivalenceClass(int equivalenceClass)
equivalenceClass
- The equivalence class for this predicate.
int getEquivalenceClass()
public void categorize() throws StandardException
StandardException
- Thrown on errorpublic RelationalOperator getRelop()
public final boolean isOrList()
public final boolean isStoreQualifier()
Current 2 types of predicates can be pushed to store: 1) RelationalOperator - represented with by left operand as instance of RelationalOperator. 2) A single And'd term of a list of OR terms represented by left operand as instance of OrNode. More checking specific operator's terms to see if they are finally pushable to store. In the final push at execution each term of the AND or OR must be a Relational operator with a column reference on one side and a constant on the other.
StandardException
- Standard exception policy.public final boolean isPushableOrClause(Optimizable optTable) throws StandardException
Does the predicate represent a AND'd list of OR term's, all of which are pushable. To be pushable each of OR terms must be a legal qualifier, which is a column reference on one side of a Relational operator and a constant on the other.
StandardException
- Standard exception policy.boolean transitiveSearchClauseAdded(RelationalOperator ro)
ro
- The search clause that we are currently considering
as the source for transitive closure
void setTransitiveSearchClauseAdded(RelationalOperator ro)
ro
- The search clause that we are currently considering
as the source for transitive closure
int getStartOperator(Optimizable optTable)
optTable
- The optimizable table, so we can tell which side of
the operator the search column is on.
int getStopOperator(Optimizable optTable)
void setIndexPosition(int indexPosition)
indexPosition
- The position of the index column that this
predicate restricts.void clearScanFlags()
void clearQualifierFlag()
void generateExpressionOperand(Optimizable optTable, int columnPosition, ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
StandardException
void generateAbsoluteColumnId(MethodBuilder mb, Optimizable optTable)
void generateRelativeColumnId(MethodBuilder mb, Optimizable optTable)
void generateOperator(MethodBuilder mb, Optimizable optTable)
void generateQualMethod(ExpressionClassBuilder acb, MethodBuilder mb, Optimizable optTable) throws StandardException
StandardException
void generateOrderedNulls(MethodBuilder mb)
void generateNegate(MethodBuilder mb, Optimizable optTable)
void generateOrderableVariantType(MethodBuilder mb, Optimizable optTable) throws StandardException
StandardException
public java.lang.String toString()
toString
in class QueryTreeNode
public void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the tree
public Visitable accept(Visitor v) throws StandardException
accept
in interface Visitable
accept
in class QueryTreeNode
v
- the visitor
StandardException
- on errorpublic void copyFields(Predicate otherPred)
public java.util.Hashtable getSearchClauseHT()
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |