Class ComposedBitmapIndexQueryPlan
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.bitmap.ComposedBitmapIndexQueryPlan
-
- All Implemented Interfaces:
PlanHashable
,QueryPlan<FDBQueriedRecord<Message>>
,RecordQueryPlan
,RecordQueryPlanWithNoChildren
,Bindable
,Correlated<RelationalExpression>
,PlannerGraphRewritable
,RelationalExpression
@API(EXPERIMENTAL) public class ComposedBitmapIndexQueryPlan extends Object implements RecordQueryPlanWithNoChildren
A query plan implementing a bit-wise merge of two or more covering index scans ofBITMAP_VALUE
indexes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ComposedBitmapIndexQueryPlan.ComposerBase
Plan extension ofComposedBitmapIndexCursor.Composer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
boolean
equalsWithoutChildren(RelationalExpression other, AliasMap equivalences)
<M extends Message>
RecordCursor<FDBQueriedRecord<M>>execute(FDBRecordStoreBase<M> store, EvaluationContext context, byte[] continuation, ExecuteProperties executeProperties)
Execute this query plan.AvailableFields
getAvailableFields()
int
getComplexity()
Returns an integer representing the "complexity" of the generated plan.ComposedBitmapIndexQueryPlan.ComposerBase
getComposer()
Set<CorrelationIdentifier>
getCorrelatedTo()
Returns the set ofCorrelationIdentifier
s this entity is correlated to.List<RecordQueryCoveringIndexPlan>
getIndexPlans()
Set<String>
getUsedIndexes()
Returns a set of names of the indexes used by this plan (and its sub-plans).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
hasLoadBykeys()
Indicates whether this plan (or one of its components) loads records by their primary key.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.ComposedBitmapIndexQueryPlan
rebase(AliasMap translationMap)
Rebases this and all other objects this objects is composed of using a given translation map.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.RecordQueryPlanWithNoChildren
getChildren, getQuantifiers
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.RelationalExpression
acceptPropertyVisitor, bindTo, canCorrelate, semanticEquals, semanticEquals, semanticHashCode, show
-
-
-
-
Method Detail
-
getIndexPlans
@Nonnull public List<RecordQueryCoveringIndexPlan> getIndexPlans()
-
getComposer
@Nonnull public ComposedBitmapIndexQueryPlan.ComposerBase getComposer()
-
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
-
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>>
- 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>>
- 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>>
- 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>>
- Returns:
- an set of indexes used by this plan
-
hasLoadBykeys
public boolean hasLoadBykeys()
Description copied from interface:QueryPlan
Indicates whether this plan (or one of its components) loads records by their primary key.- Specified by:
hasLoadBykeys
in interfaceQueryPlan<FDBQueriedRecord<Message>>
- Returns:
true
if this plan (or one of its components) loads records by their primary key
-
getAvailableFields
@Nonnull public AvailableFields getAvailableFields()
- Specified by:
getAvailableFields
in interfaceRecordQueryPlan
-
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
-
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.
-
getCorrelatedTo
@Nonnull public Set<CorrelationIdentifier> getCorrelatedTo()
Description copied from interface:Correlated
Returns the set ofCorrelationIdentifier
s this entity is correlated to. This means that without a process that binds these correlations to values, theRelationalExpression
(or others that implement this interface) cannot even in principle produce a meaningful result. As often times entities that implement this interface use composition and effectively describe trees or DAGs, this method should be the set union of theCorrelationIdentifier
s this object is correlated to as well as all children, constituent parts, etc.- Specified by:
getCorrelatedTo
in interfaceCorrelated<RelationalExpression>
- Returns:
- the set of
CorrelationIdentifier
s this entity is correlated to
-
rebase
@Nonnull public ComposedBitmapIndexQueryPlan rebase(@Nonnull AliasMap translationMap)
Description copied from interface:Correlated
Rebases this and all other objects this objects is composed of using a given translation map.- Specified by:
rebase
in interfaceCorrelated<RelationalExpression>
- Parameters:
translationMap
- a map defining a translation fromCorrelationIdentifier
sids
toCorrelationIdentifier
sids'
. After the rebase, every correlation to anid
containedids
that is contained or referred to directly or indirectly bythis
must have been transformed to use the mapped counterpart ofid
id'
inids'
. IDs not contained in the translation map must remain unmodified by the rebase operation.- Returns:
- a new entity that has been rebased
-
equalsWithoutChildren
public boolean equalsWithoutChildren(@Nonnull RelationalExpression other, @Nonnull AliasMap equivalences)
- Specified by:
equalsWithoutChildren
in interfaceRelationalExpression
-
hashCodeWithoutChildren
public int hashCodeWithoutChildren()
- Specified by:
hashCodeWithoutChildren
in interfaceRelationalExpression
-
-