org.apache.derby.impl.sql.compile
Class Predicate
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.Predicate
-
- All Implemented Interfaces:
- java.lang.Comparable<Predicate>, OptimizablePredicate, Visitable
public final class Predicate extends QueryTreeNode implements OptimizablePredicate, java.lang.Comparable<Predicate>
A Predicate represents a top level predicate.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(Predicate other)booleancompareWithKnownConstant(Optimizable optTable, boolean considerParameters)Is this predicate a comparison with a known constant value?booleanequalsComparisonWithConstantExpression(Optimizable optTable)Is this predicate an equality comparison with a constant expression? (IS NULL is considered to be an = comparison with a constant expression).DataValueDescriptorgetCompareValue(Optimizable optTable)Get an Object representing the known constant value that the given Optimizable is being compared to.intgetIndexPosition()Get the position of the index column that this predicate restricts.JBitSetgetReferencedMap()Get the map of referenced tables for this OptimizablePredicate.inthasEqualOnColumnList(int[] baseColumnPositions, Optimizable optTable)Returns if the predicate involves an equal operator on one of the columns specified in the baseColumnPositions.booleanhasMethodCall()Return whether or not an OptimizablePredicate contains a method call.booleanhasSubquery()Return whether or not an OptimizablePredicate contains a subquery.booleanisQualifier()Is this predicate a qualifier?booleanisStartKey()Is this predicate a start key?booleanisStopKey()Is this predicate a stop key?voidmarkQualifier()Tell the predicate that it is to be used as a qualifier in an index scan.voidmarkStartKey()Tell the predicate that it is to be used as a column in the start key value for an index scan.voidmarkStopKey()Tell the predicate that it is to be used as a column in the stop key value for an index scan.doubleselectivity(Optimizable optTable)Get a (crude) estimate of the selectivity of this predicate.java.lang.StringtoString()Convert this object to a String.-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, createTypeDependency, getBeginOffset, getDataDictionary, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getUDTDesc, isAtomic, makeConstantAction, makeTableName, makeTableName, optimizerTracingIsOn, orReliability, referencesSessionSchema, setBeginOffset, setEndOffset, taggedWith, treePrint
-
-
-
-
Method Detail
-
getReferencedMap
public JBitSet getReferencedMap()
Description copied from interface:OptimizablePredicateGet the map of referenced tables for this OptimizablePredicate.- Specified by:
getReferencedMapin interfaceOptimizablePredicate- Returns:
- JBitSet Referenced table map.
- See Also:
OptimizablePredicate.getReferencedMap()
-
hasSubquery
public boolean hasSubquery()
Description copied from interface:OptimizablePredicateReturn whether or not an OptimizablePredicate contains a subquery.- Specified by:
hasSubqueryin interfaceOptimizablePredicate- Returns:
- boolean Whether or not an OptimizablePredicate includes a subquery.
- See Also:
OptimizablePredicate.hasSubquery()
-
hasMethodCall
public boolean hasMethodCall()
Description copied from interface:OptimizablePredicateReturn whether or not an OptimizablePredicate contains a method call.- Specified by:
hasMethodCallin interfaceOptimizablePredicate- Returns:
- boolean Whether or not an OptimizablePredicate includes a method call.
- See Also:
OptimizablePredicate.hasMethodCall()
-
markStartKey
public void markStartKey()
Description copied from interface:OptimizablePredicateTell the predicate that it is to be used as a column in the start key value for an index scan.- Specified by:
markStartKeyin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.markStartKey()
-
isStartKey
public boolean isStartKey()
Description copied from interface:OptimizablePredicateIs this predicate a start key?- Specified by:
isStartKeyin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.isStartKey()
-
markStopKey
public void markStopKey()
Description copied from interface:OptimizablePredicateTell the predicate that it is to be used as a column in the stop key value for an index scan.- Specified by:
markStopKeyin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.markStopKey()
-
isStopKey
public boolean isStopKey()
Description copied from interface:OptimizablePredicateIs this predicate a stop key?- Specified by:
isStopKeyin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.isStopKey()
-
markQualifier
public void markQualifier()
Description copied from interface:OptimizablePredicateTell the predicate that it is to be used as a qualifier in an index scan.- Specified by:
markQualifierin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.markQualifier()
-
isQualifier
public boolean isQualifier()
Description copied from interface:OptimizablePredicateIs this predicate a qualifier?- Specified by:
isQualifierin interfaceOptimizablePredicate- See Also:
OptimizablePredicate.isQualifier()
-
compareWithKnownConstant
public boolean compareWithKnownConstant(Optimizable optTable, boolean considerParameters)
Description copied from interface:OptimizablePredicateIs this predicate a comparison with a known constant value?- Specified by:
compareWithKnownConstantin interfaceOptimizablePredicate- Parameters:
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.- See Also:
OptimizablePredicate.compareWithKnownConstant(org.apache.derby.iapi.sql.compile.Optimizable, boolean)
-
hasEqualOnColumnList
public int hasEqualOnColumnList(int[] baseColumnPositions, Optimizable optTable) throws StandardExceptionDescription copied from interface:OptimizablePredicateReturns if the predicate involves an equal operator on one of the columns specified in the baseColumnPositions.- Specified by:
hasEqualOnColumnListin interfaceOptimizablePredicate- Parameters:
baseColumnPositions- the column numbers on which the user wants to check if the equality condition exists.optTable- the table for which baseColumnPositions are given.- Returns:
- returns the index into baseColumnPositions of the column that has the equality operator.
- Throws:
StandardException
-
getCompareValue
public DataValueDescriptor getCompareValue(Optimizable optTable) throws StandardException
Description copied from interface:OptimizablePredicateGet an Object representing the known constant value that the given Optimizable is being compared to.- Specified by:
getCompareValuein interfaceOptimizablePredicate- Throws:
StandardException- Thrown on error- See Also:
OptimizablePredicate.getCompareValue(org.apache.derby.iapi.sql.compile.Optimizable)
-
equalsComparisonWithConstantExpression
public boolean equalsComparisonWithConstantExpression(Optimizable optTable)
Description copied from interface:OptimizablePredicateIs this predicate an equality comparison with a constant expression? (IS NULL is considered to be an = comparison with a constant expression).- Specified by:
equalsComparisonWithConstantExpressionin interfaceOptimizablePredicate- Parameters:
optTable- The Optimizable for which we want to know whether it is being equality-compared to a constant expression.- See Also:
OptimizablePredicate.equalsComparisonWithConstantExpression(org.apache.derby.iapi.sql.compile.Optimizable)
-
selectivity
public double selectivity(Optimizable optTable) throws StandardException
Description copied from interface:OptimizablePredicateGet a (crude) estimate of the selectivity of this predicate. This is to be used when no better technique is available for estimating the selectivity - this method's estimate is a hard- wired number based on the type of predicate and the datatype (the selectivity of boolean is always 50%).- Specified by:
selectivityin interfaceOptimizablePredicate- Parameters:
optTable- The Optimizable that this predicate restricts- Throws:
StandardException- See Also:
OptimizablePredicate.selectivity(org.apache.derby.iapi.sql.compile.Optimizable)
-
getIndexPosition
public int getIndexPosition()
Description copied from interface:OptimizablePredicateGet the position of the index column that this predicate restricts. NOTE: This assumes that this predicate is part of an OptimizablePredicateList, and that classify() has been called on the OptimizablePredicateList.- Specified by:
getIndexPositionin interfaceOptimizablePredicate- Returns:
- The index position that this predicate restricts (zero-based)
- See Also:
OptimizablePredicate.getIndexPosition()
-
compareTo
public int compareTo(Predicate other)
- Specified by:
compareToin interfacejava.lang.Comparable<Predicate>
-
toString
public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.- Overrides:
toStringin classQueryTreeNode- Returns:
- This object as a String
-
-
DataMelt 3.0 © DataMelt by jWork.ORG