Class LogicalTypeFilterExpression
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.expressions.LogicalTypeFilterExpression
-
- All Implemented Interfaces:
Bindable
,Correlated<RelationalExpression>
,PlannerGraphRewritable
,RelationalExpressionWithChildren
,TypeFilterExpression
,RelationalExpression
@API(EXPERIMENTAL) public class LogicalTypeFilterExpression extends Object implements TypeFilterExpression, PlannerGraphRewritable
A relational planner expression that represents an unimplemented type filter on the records produced by its inner relational planner expression.- See Also:
for the fallback implementation
-
-
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 LogicalTypeFilterExpression(Set<String> recordTypes, Quantifier inner)
LogicalTypeFilterExpression(Set<String> recordTypes, RelationalExpression inner)
-
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)
Set<CorrelationIdentifier>
getCorrelatedToWithoutChildren()
List<? extends Quantifier>
getQuantifiers()
Return an iterator of references to the children of this planner expression.Set<String>
getRecordTypes()
int
getRelationalChildCount()
Optional<List<? extends Value>>
getResultValues()
int
hashCode()
LogicalTypeFilterExpression
rebase(AliasMap translationMap)
Rebases this and all other objects this objects is composed of using a given translation map.LogicalTypeFilterExpression
rebaseWithRebasedQuantifiers(AliasMap translationMap, List<Quantifier> rebasedQuantifiers)
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.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, 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
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.expressions.RelationalExpressionWithChildren
getCorrelatedTo
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.expressions.TypeFilterExpression
equalsWithoutChildren, hashCodeWithoutChildren
-
-
-
-
Constructor Detail
-
LogicalTypeFilterExpression
public LogicalTypeFilterExpression(@Nonnull Set<String> recordTypes, @Nonnull RelationalExpression inner)
-
LogicalTypeFilterExpression
public LogicalTypeFilterExpression(@Nonnull Set<String> recordTypes, @Nonnull Quantifier inner)
-
-
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
-
getRecordTypes
@Nonnull public Set<String> getRecordTypes()
- Specified by:
getRecordTypes
in interfaceTypeFilterExpression
-
getRelationalChildCount
public int getRelationalChildCount()
- Specified by:
getRelationalChildCount
in interfaceRelationalExpressionWithChildren
-
getCorrelatedToWithoutChildren
@Nonnull public Set<CorrelationIdentifier> getCorrelatedToWithoutChildren()
- Specified by:
getCorrelatedToWithoutChildren
in interfaceRelationalExpressionWithChildren
-
rebase
@Nonnull public LogicalTypeFilterExpression 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>
- Specified by:
rebase
in interfaceRelationalExpressionWithChildren
- Specified by:
rebase
in interfaceTypeFilterExpression
- 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
-
rebaseWithRebasedQuantifiers
@Nonnull public LogicalTypeFilterExpression rebaseWithRebasedQuantifiers(@Nonnull AliasMap translationMap, @Nonnull List<Quantifier> rebasedQuantifiers)
- Specified by:
rebaseWithRebasedQuantifiers
in interfaceRelationalExpressionWithChildren
-
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.
-
-