@API(value=MAINTAINED) public class RecordQueryIntersectionPlan extends Object implements RecordQueryPlanWithChildren
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOGGER |
Constructor and Description |
---|
RecordQueryIntersectionPlan(List<RecordQueryPlan> children,
KeyExpression comparisonKey,
boolean reverse)
Deprecated.
in favor of
from(List, KeyExpression) |
RecordQueryIntersectionPlan(RecordQueryPlan left,
RecordQueryPlan right,
KeyExpression comparisonKey,
boolean reverse)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
boolean |
equalsWithoutChildren(PlannerExpression otherExpression) |
<M extends Message> |
execute(FDBRecordStoreBase<M> store,
EvaluationContext context,
byte[] continuation,
ExecuteProperties executeProperties)
Execute this query plan.
|
static RecordQueryIntersectionPlan |
from(List<RecordQueryPlan> children,
KeyExpression comparisonKey)
Construct a new union of two or more compatibly-ordered plans.
|
static RecordQueryIntersectionPlan |
from(RecordQueryPlan left,
RecordQueryPlan right,
KeyExpression comparisonKey)
Construct a new union of two compatibly-ordered plans.
|
List<RecordQueryPlan> |
getChildren()
Returns the (zero or more)
RecordQueryPlan children of this plan. |
KeyExpression |
getComparisonKey() |
int |
getComplexity()
Returns an integer representing the "complexity" of the generated plan.
|
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
int |
getRelationalChildCount() |
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() |
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 appropriate
StoreTimer 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 to
hashCode , but with the additional guarantee that is is stable across JVMs. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asNestedWith, asUnnestedWith, execute, execute, execute, getQueryPlanChildren
execute, execute
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
fromRecordQuery
acceptPropertyVisitor, bindTo
@API(value=DEPRECATED) @Deprecated public RecordQueryIntersectionPlan(@Nonnull RecordQueryPlan left, @Nonnull RecordQueryPlan right, @Nonnull KeyExpression comparisonKey, boolean reverse)
from(RecordQueryPlan, RecordQueryPlan, KeyExpression)
from(RecordQueryPlan, RecordQueryPlan, KeyExpression)
.left
- the first plan to intersectright
- the second plan to intersectcomparisonKey
- a key expression by which the results of both plans are orderedreverse
- whether both plans return results in reverse (i.e., descending) order by the comparison key@API(value=DEPRECATED) @Deprecated public RecordQueryIntersectionPlan(@Nonnull List<RecordQueryPlan> children, @Nonnull KeyExpression comparisonKey, boolean reverse)
from(List, KeyExpression)
from(List, KeyExpression)
.children
- the list of plans to take the intersection ofcomparisonKey
- a key expression by which the results of both plans are orderedreverse
- whether all plans return results in reverse (i.e., descending) order by the comparison key@Nonnull public <M extends Message> RecordCursor<FDBQueriedRecord<M>> execute(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable byte[] continuation, @Nonnull ExecuteProperties executeProperties)
RecordQueryPlan
execute
in interface RecordQueryPlan
M
- type used to represent stored recordsstore
- record store from which to fetch recordscontext
- evaluation context containing parameter bindingscontinuation
- continuation from a previous execution of this same planexecuteProperties
- limits on executionpublic boolean isReverse()
QueryPlan
true
if the plan
returns elements in descending order and false
if the elements are
returned in ascending order.isReverse
in interface QueryPlan<FDBQueriedRecord<Message>>
true
if this plan returns elements in reverse orderpublic boolean hasRecordScan()
QueryPlan
hasRecordScan
in interface QueryPlan<FDBQueriedRecord<Message>>
true
if this plan (or one of its components) scans at least a subset of the records directlypublic boolean hasFullRecordScan()
QueryPlan
hasRecordScan
for the comparison between two methods.hasFullRecordScan
in interface QueryPlan<FDBQueriedRecord<Message>>
true
if this plan (or one of its components) must perform a scan over all records in the
store directlypublic boolean hasIndexScan(@Nonnull String indexName)
QueryPlan
hasIndexScan
in interface QueryPlan<FDBQueriedRecord<Message>>
indexName
- the name of the index to check fortrue
if this plan (or one of its children) scans the given index@Nonnull public List<RecordQueryPlan> getChildren()
RecordQueryPlan
RecordQueryPlan
children of this plan.
Warning: This part of the API is undergoing active development. At some point in the future,
the return type of this method will change to allow it to return a list of generic QueryPlan
s.
At current, every RecordQueryPlan
can only have other RecordQueryPlan
s as children.
However, this is not guaranteed to be the case in the future. This method has been marked as
API.Status#UNSTABLE
as of version 2.5.
getChildren
in interface RecordQueryPlan
@Nonnull public KeyExpression getComparisonKey()
@Nonnull public Set<String> getUsedIndexes()
QueryPlan
getUsedIndexes
in interface QueryPlan<FDBQueriedRecord<Message>>
@Nonnull @API(value=EXPERIMENTAL) public Iterator<? extends ExpressionRef<? extends PlannerExpression>> getPlannerExpressionChildren()
PlannerExpression
Collections.emptyIterator()
is returned. The returned iterator should
be treated as an immutable object and may throw an exception if Iterator.remove()
is called.
The iterator must return its elements in a consistent order.getPlannerExpressionChildren
in interface PlannerExpression
@API(value=EXPERIMENTAL) public boolean equalsWithoutChildren(@Nonnull PlannerExpression otherExpression)
equalsWithoutChildren
in interface PlannerExpression
public int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable
public void logPlanStructure(StoreTimer timer)
QueryPlan
StoreTimer
counter for each plan and subplan of this plan, allowing tracking
of which plans are being chosen (e.g. index scan vs. full scan).logPlanStructure
in interface QueryPlan<FDBQueriedRecord<Message>>
timer
- the counters to incrementpublic int getComplexity()
QueryPlan
getComplexity
in interface QueryPlan<FDBQueriedRecord<Message>>
public int getRelationalChildCount()
getRelationalChildCount
in interface RelationalExpressionWithChildren
@Nonnull public static RecordQueryIntersectionPlan from(@Nonnull RecordQueryPlan left, @Nonnull RecordQueryPlan right, @Nonnull KeyExpression comparisonKey)
left
or right
child plans. Each plan should return results in the same
order according to the provided comparisonKey
. The two children should also either both return results
in forward order, or they should both return results in reverse order. (That is, left.isReverse()
should
equal right.isReverse()
.)left
- the first plan to intersectright
- the second plan to intersectcomparisonKey
- a key expression by which the results of both plans are ordered@Nonnull public static RecordQueryIntersectionPlan from(@Nonnull List<RecordQueryPlan> children, @Nonnull KeyExpression comparisonKey)
comparisonKey
. The children should also either all return results in forward order, or they should all
return results in reverse order. (That is, QueryPlan.isReverse()
should return the same value
for each child.)children
- the list of plans to take the intersection ofcomparisonKey
- a key expression by which the results of both plans are ordered