Class FullUnorderedScanExpression
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.expressions.FullUnorderedScanExpression
-
- All Implemented Interfaces:
Bindable
,Correlated<RelationalExpression>
,PlannerGraphRewritable
,RelationalExpression
@API(EXPERIMENTAL) public class FullUnorderedScanExpression extends Object implements RelationalExpression, PlannerGraphRewritable
A planner expression representing a full, unordered scan of the records by primary key, which is the logical version of aRecordQueryScanPlan
withScanComparisons.EMPTY
. Unlike aRecordQueryScanPlan
, aFullUnorderedScanExpression
is not implicitly ordered by the primary key.This expression is useful as the source of records for the initial planner expression produced from a
RecordQuery
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.apple.foundationdb.record.query.plan.temp.Correlated
Correlated.BoundEquivalence
-
Nested classes/interfaces inherited from interface com.apple.foundationdb.record.query.plan.temp.RelationalExpression
RelationalExpression.CombineFunction<R,S>, RelationalExpression.CombinePredicate
-
-
Constructor Summary
Constructors Constructor Description FullUnorderedScanExpression(Set<String> recordTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Compensation
compensate(PartialMatch partialMatch, Map<CorrelationIdentifier,ComparisonRange> boundParameterPrefixMap)
boolean
equals(Object other)
boolean
equalsWithoutChildren(RelationalExpression otherExpression, AliasMap equivalencesMap)
Set<CorrelationIdentifier>
getCorrelatedTo()
Returns the set ofCorrelationIdentifier
s this entity is correlated to.List<? extends Quantifier>
getQuantifiers()
Return an iterator of references to the children of this planner expression.Set<String>
getRecordTypes()
Optional<List<? extends Value>>
getResultValues()
int
hashCode()
int
hashCodeWithoutChildren()
FullUnorderedScanExpression
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.Iterable<MatchInfo>
subsumedBy(RelationalExpression candidateExpression, AliasMap aliasMap, IdentityBiMap<Quantifier,PartialMatch> partialMatchMap)
Try to establish ifotherExpression
subsumes this one.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.temp.RelationalExpression
acceptPropertyVisitor, adjustMatch, bindIdentities, bindTo, canCorrelate, enumerateUnboundCorrelatedTo, exactlySubsumedBy, findMatches, hasIncompatibleBoundQuantifiers, hasUnboundQuantifiers, match, match, semanticEquals, semanticEquals, semanticHashCode, show
-
-
-
-
Method Detail
-
getResultValues
@Nonnull public Optional<List<? extends Value>> getResultValues()
- Specified by:
getResultValues
in interfaceRelationalExpression
-
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
-
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 FullUnorderedScanExpression 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 otherExpression, @Nonnull AliasMap equivalencesMap)
- Specified by:
equalsWithoutChildren
in interfaceRelationalExpression
-
hashCodeWithoutChildren
public int hashCodeWithoutChildren()
- Specified by:
hashCodeWithoutChildren
in interfaceRelationalExpression
-
subsumedBy
@Nonnull public Iterable<MatchInfo> subsumedBy(@Nonnull RelationalExpression candidateExpression, @Nonnull AliasMap aliasMap, @Nonnull IdentityBiMap<Quantifier,PartialMatch> partialMatchMap)
Description copied from interface:RelationalExpression
Try to establish ifotherExpression
subsumes this one. If two expression are semantically equal (e.g. in structure or by other means of reasoning) they should exactly return the same records. There are use cases where semantic equality is too strict and not that useful. During index matching we don't necessarily need to know if two expressions produce the same result, we just need to know that the candidate scan produces a (non-proper) super multiset of records (the candidate therefore includes all records warranted by the query) and we can match query against that candidate. The difference between result set produced by the candidate and the query then must be corrected by applying compensation. The following tautologies apply:- If query and candidate are semantically equivalent, the query side should match to the candidate side without any compensation. In other words the query expression can simply be replaced by the candidate expression.
- If the candidate is matched and we decide to rewrite this query expression with the appropriate top expression on the candidate side then it holds that the query expression is equivalent to the computed compensation of the match over the candidate scan.
- A query cannot match to a candidate if it cannot be proven that the candidate cannot at least produce all the records that the query may produce.
- Specified by:
subsumedBy
in interfaceRelationalExpression
- Parameters:
candidateExpression
- the candidate expressionaliasMap
- a map of alias defining the equivalence between aliases and therefore quantifierspartialMatchMap
- a map from quantifier to aPartialMatch
that pulled up along that quantifier from one of the expressions below that quantifier- Returns:
- an iterable of
MatchInfo
s if subsumption between this expression and the candidate expression can be established
-
compensate
public Compensation compensate(@Nonnull PartialMatch partialMatch, @Nonnull Map<CorrelationIdentifier,ComparisonRange> boundParameterPrefixMap)
- Specified by:
compensate
in interfaceRelationalExpression
-
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.
-
-