Class RecordQueryPredicateFilterPlan
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.plans.RecordQueryPredicateFilterPlan
-
- All Implemented Interfaces:
PlanHashable
,QueryPlan<FDBQueriedRecord<Message>>
,RecordQueryPlan
,RecordQueryPlanWithChild
,RecordQueryPlanWithChildren
,Bindable
,Correlated<RelationalExpression>
,PlannerGraphRewritable
,RelationalExpressionWithChildren
,RelationalExpression
,RelationalExpressionWithPredicate
@API(EXPERIMENTAL) public class RecordQueryPredicateFilterPlan extends Object implements RelationalExpressionWithPredicate
A query plan that filters out records from a child plan that do not satisfy aQueryPredicate
.
-
-
Constructor Summary
Constructors Constructor Description RecordQueryPredicateFilterPlan(Quantifier.Physical inner, Source baseSource, QueryPredicate filter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
boolean
equalsWithoutChildren(RelationalExpression otherExpression, AliasMap equivalencesMap)
protected <M extends Message>
BooleanevalFilter(FDBRecordStoreBase<M> store, EvaluationContext context, FDBRecord<M> record)
protected <M extends Message>
CompletableFuture<Boolean>evalFilterAsync(FDBRecordStoreBase<M> store, EvaluationContext context, FDBRecord<M> record)
<M extends Message>
RecordCursor<FDBQueriedRecord<M>>execute(FDBRecordStoreBase<M> store, EvaluationContext context, byte[] continuation, ExecuteProperties executeProperties)
Execute this query plan.AvailableFields
getAvailableFields()
Source
getBaseSource()
RecordQueryPlan
getChild()
int
getComplexity()
Returns an integer representing the "complexity" of the generated plan.Set<CorrelationIdentifier>
getCorrelatedToWithoutChildren()
RecordQueryPlan
getInnerPlan()
QueryPredicate
getPredicate()
List<? extends Quantifier>
getQuantifiers()
Return an iterator of references to the children of this planner expression.Set<String>
getUsedIndexes()
Returns a set of names of the indexes used by this plan (and its sub-plans).protected boolean
hasAsyncFilter()
boolean
hasFullRecordScan()
Indicates whether this plan (or one of its components) must perform a scan over all records in the store directly rather than going through a secondary index.int
hashCode()
int
hashCodeWithoutChildren()
boolean
hasIndexScan(String indexName)
Indicates whether this plan scans the given index.boolean
hasRecordScan()
Indicates whether this plan (or one of its components) scans at least a subset of the record range directly rather than going through a secondary index.boolean
isReverse()
Indicates whether this plan will return values in "reverse" order from the natural order of results of this plan.void
logPlanStructure(StoreTimer timer)
Adds one to an appropriateStoreTimer
counter for each plan and subplan of this plan, allowing tracking of which plans are being chosen (e.g.int
planHash()
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.RecordQueryPredicateFilterPlan
rebaseWithRebasedQuantifiers(AliasMap translationMap, List<Quantifier> rebasedQuantifiers)
PlannerGraph
rewritePlannerGraph(List<? extends PlannerGraph> childGraphs)
Method to rewrite the planner graph.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.plans.QueryPlan
execute, execute
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.plans.RecordQueryPlan
accept, execute, execute, execute, getQueryPlanChildren, structuralEquals, structuralEquals, structuralHashCode
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.plans.RecordQueryPlanWithChild
getChildren, getRelationalChildCount, hasLoadBykeys
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.RelationalExpression
acceptPropertyVisitor, bindTo, canCorrelate, getQuantifiers, semanticEquals, semanticEquals, semanticHashCode, show
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.expressions.RelationalExpressionWithChildren
getCorrelatedTo, rebase
-
-
-
-
Constructor Detail
-
RecordQueryPredicateFilterPlan
public RecordQueryPredicateFilterPlan(@Nonnull Quantifier.Physical inner, @Nonnull Source baseSource, @Nonnull QueryPredicate filter)
-
-
Method Detail
-
hasAsyncFilter
protected boolean hasAsyncFilter()
-
evalFilter
@Nullable protected <M extends Message> Boolean evalFilter(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable FDBRecord<M> record)
-
evalFilterAsync
@Nullable protected <M extends Message> CompletableFuture<Boolean> evalFilterAsync(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable FDBRecord<M> record)
-
getPredicate
@Nonnull public QueryPredicate getPredicate()
- Specified by:
getPredicate
in interfaceRelationalExpressionWithPredicate
-
getAvailableFields
@Nonnull public AvailableFields getAvailableFields()
- Specified by:
getAvailableFields
in interfaceRecordQueryPlan
- Specified by:
getAvailableFields
in interfaceRecordQueryPlanWithChild
-
getCorrelatedToWithoutChildren
@Nonnull public Set<CorrelationIdentifier> getCorrelatedToWithoutChildren()
- Specified by:
getCorrelatedToWithoutChildren
in interfaceRelationalExpressionWithChildren
-
rebaseWithRebasedQuantifiers
@Nonnull public RecordQueryPredicateFilterPlan rebaseWithRebasedQuantifiers(@Nonnull AliasMap translationMap, @Nonnull List<Quantifier> rebasedQuantifiers)
- Specified by:
rebaseWithRebasedQuantifiers
in interfaceRelationalExpressionWithChildren
- Specified by:
rebaseWithRebasedQuantifiers
in interfaceRelationalExpressionWithPredicate
-
equalsWithoutChildren
public boolean equalsWithoutChildren(@Nonnull RelationalExpression otherExpression, @Nonnull AliasMap equivalencesMap)
- Specified by:
equalsWithoutChildren
in interfaceRelationalExpression
-
hashCodeWithoutChildren
public int hashCodeWithoutChildren()
- Specified by:
hashCodeWithoutChildren
in interfaceRelationalExpression
-
planHash
public int planHash()
Description copied from interface:PlanHashable
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Specified by:
planHash
in interfacePlanHashable
- Returns:
- a stable hash code
-
rewritePlannerGraph
@Nonnull public PlannerGraph rewritePlannerGraph(@Nonnull List<? extends PlannerGraph> childGraphs)
Description copied from interface:PlannerGraphRewritable
Method to rewrite the planner graph.- Specified by:
rewritePlannerGraph
in interfacePlannerGraphRewritable
- Parameters:
childGraphs
- planner graphs of children expression that already have been computed- Returns:
- a new planner graph that can combine the
childGraph
s in a meaningful way. Note that there is no obligation to use thechildGraph
s at all, this method can create a new independent planner graph completely from scratch.
-
execute
@Nonnull public <M extends Message> RecordCursor<FDBQueriedRecord<M>> execute(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable byte[] continuation, @Nonnull ExecuteProperties executeProperties)
Description copied from interface:RecordQueryPlan
Execute this query plan.- Specified by:
execute
in interfaceRecordQueryPlan
- Type Parameters:
M
- type used to represent stored records- Parameters:
store
- record store from which to fetch recordscontext
- evaluation context containing parameter bindingscontinuation
- continuation from a previous execution of this same planexecuteProperties
- limits on execution- Returns:
- a cursor of records that match the query criteria
-
getInnerPlan
@Nonnull public RecordQueryPlan getInnerPlan()
-
getQuantifiers
@Nonnull public List<? extends Quantifier> getQuantifiers()
Description copied from interface:RelationalExpression
Return an iterator of references to the children of this planner expression. The iterators returned by different calls are guaranteed to be independent (i.e., advancing one will not advance another). However, they might point to the same object, as whenCollections.emptyIterator()
is returned. The returned iterator should be treated as an immutable object and may throw an exception ifIterator.remove()
is called. The iterator must return its elements in a consistent order.- Specified by:
getQuantifiers
in interfaceRelationalExpression
- Returns:
- an iterator of references to the children of this planner expression
-
isReverse
public boolean isReverse()
Description copied from interface:QueryPlan
Indicates whether this plan will return values in "reverse" order from the natural order of results of this plan. The return value istrue
if the plan returns elements in descending order andfalse
if the elements are returned in ascending order.- Specified by:
isReverse
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Returns:
true
if this plan returns elements in reverse order
-
hasRecordScan
public boolean hasRecordScan()
Description copied from interface:QueryPlan
Indicates whether this plan (or one of its components) scans at least a subset of the record range directly rather than going through a secondary index. A plan may only scan over a subset of all records. Someone might not use any secondary indexes explicitly, but they might make use of the primary key index. For example, if they had a compound primary key, and they issued a query for all records that had some value for the first element of their primary key, the planner will produce a plan which scans over a subset of all records.- Specified by:
hasRecordScan
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Specified by:
hasRecordScan
in interfaceRecordQueryPlanWithChild
- Specified by:
hasRecordScan
in interfaceRecordQueryPlanWithChildren
- Returns:
true
if this plan (or one of its components) scans at least a subset of the records directly
-
hasFullRecordScan
public boolean hasFullRecordScan()
Description copied from interface:QueryPlan
Indicates whether this plan (or one of its components) must perform a scan over all records in the store directly rather than going through a secondary index. SeehasRecordScan
for the comparison between two methods.- Specified by:
hasFullRecordScan
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Specified by:
hasFullRecordScan
in interfaceRecordQueryPlanWithChild
- Specified by:
hasFullRecordScan
in interfaceRecordQueryPlanWithChildren
- Returns:
true
if this plan (or one of its components) must perform a scan over all records in the store directly
-
hasIndexScan
public boolean hasIndexScan(@Nonnull String indexName)
Description copied from interface:QueryPlan
Indicates whether this plan scans the given index.- Specified by:
hasIndexScan
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Specified by:
hasIndexScan
in interfaceRecordQueryPlanWithChild
- Specified by:
hasIndexScan
in interfaceRecordQueryPlanWithChildren
- Parameters:
indexName
- the name of the index to check for- Returns:
true
if this plan (or one of its children) scans the given index
-
getUsedIndexes
@Nonnull public Set<String> getUsedIndexes()
Description copied from interface:QueryPlan
Returns a set of names of the indexes used by this plan (and its sub-plans).- Specified by:
getUsedIndexes
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Specified by:
getUsedIndexes
in interfaceRecordQueryPlanWithChild
- Specified by:
getUsedIndexes
in interfaceRecordQueryPlanWithChildren
- Returns:
- an set of indexes used by this plan
-
getChild
@Nonnull public RecordQueryPlan getChild()
- Specified by:
getChild
in interfaceRecordQueryPlanWithChild
-
logPlanStructure
public void logPlanStructure(StoreTimer timer)
Description copied from interface:QueryPlan
Adds one to an appropriateStoreTimer
counter for each plan and subplan of this plan, allowing tracking of which plans are being chosen (e.g. index scan vs. full scan).- Specified by:
logPlanStructure
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Parameters:
timer
- the counters to increment
-
getComplexity
public int getComplexity()
Description copied from interface:QueryPlan
Returns an integer representing the "complexity" of the generated plan. Currently, this should simply be the number of plans in the plan tree with this plan as the root (i.e. the number of descendants of this plan, including itself).- Specified by:
getComplexity
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Returns:
- the complexity of this plan
-
-