Interface OptimizablePredicate
- All Known Implementing Classes:
Predicate
public interface OptimizablePredicate
OptimizablePredicate provides services for optimizing predicates in a query.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
compareWithKnownConstant
(Optimizable optTable, boolean considerParameters) Is this predicate a comparison with a known constant value?boolean
Is this predicate an equality comparison with a constant expression?getCompareValue
(Optimizable optTable) Get an Object representing the known constant value that the given Optimizable is being compared to.int
Get the position of the index column that this predicate restricts.Get the map of referenced tables for this OptimizablePredicate.int
hasEqualOnColumnList
(int[] baseColumnPositions, Optimizable optTable) Returns if the predicate involves an equal operator on one of the columns specified in the baseColumnPositions.boolean
Return whether or not an OptimizablePredicate contains a method call.boolean
Return whether or not an OptimizablePredicate contains a subquery.boolean
Is this predicate a qualifier?boolean
Is this predicate a start key?boolean
Is this predicate a stop key?void
Tell the predicate that it is to be used as a qualifier in an index scan.void
Tell the predicate that it is to be used as a column in the start key value for an index scan.void
Tell the predicate that it is to be used as a column in the stop key value for an index scan.double
selectivity
(Optimizable optTable) Get a (crude) estimate of the selectivity of this predicate.
-
Method Details
-
getReferencedMap
JBitSet getReferencedMap()Get the map of referenced tables for this OptimizablePredicate.- Returns:
- JBitSet Referenced table map.
-
hasSubquery
boolean hasSubquery()Return whether or not an OptimizablePredicate contains a subquery.- Returns:
- boolean Whether or not an OptimizablePredicate includes a subquery.
-
hasMethodCall
boolean hasMethodCall()Return whether or not an OptimizablePredicate contains a method call.- Returns:
- boolean Whether or not an OptimizablePredicate includes a method call.
-
markStartKey
void markStartKey()Tell the predicate that it is to be used as a column in the start key value for an index scan. -
isStartKey
boolean isStartKey()Is this predicate a start key? -
markStopKey
void markStopKey()Tell the predicate that it is to be used as a column in the stop key value for an index scan. -
isStopKey
boolean isStopKey()Is this predicate a stop key? -
markQualifier
void markQualifier()Tell the predicate that it is to be used as a qualifier in an index scan. -
isQualifier
boolean isQualifier()Is this predicate a qualifier? -
compareWithKnownConstant
Is this predicate a comparison with a known constant value?- 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.
-
getCompareValue
Get an Object representing the known constant value that the given Optimizable is being compared to.- Throws:
StandardException
- Thrown on error
-
equalsComparisonWithConstantExpression
Is this predicate an equality comparison with a constant expression? (IS NULL is considered to be an = comparison with a constant expression).- Parameters:
optTable
- The Optimizable for which we want to know whether it is being equality-compared to a constant expression.
-
hasEqualOnColumnList
Returns if the predicate involves an equal operator on one of the columns specified in the baseColumnPositions.- 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
-
selectivity
Get 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%).- Parameters:
optTable
- The Optimizable that this predicate restricts- Throws:
StandardException
-
getIndexPosition
int getIndexPosition()Get 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.- Returns:
- The index position that this predicate restricts (zero-based)
-