Class CascadesRuleCall
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.CascadesRuleCall
-
- All Implemented Interfaces:
PlannerRuleCall
@API(EXPERIMENTAL) public class CascadesRuleCall extends Object implements PlannerRuleCall
A rule call implementation for theCascadesPlanner
. This rule call implements the logic for handling new expressions as they are generated by aPlannerRule.onMatch(PlannerRuleCall)
and passed to the rule call via theyield(ExpressionRef)
method, which consists primarily of manipulating the implicit a memo data structure defined byGroupExpressionRef
s andRelationalExpression
s. An invoked rule can in turn callyield(com.apple.foundationdb.record.query.plan.temp.ExpressionRef<? extends com.apple.foundationdb.record.query.plan.temp.RelationalExpression>)
oryieldPartialMatch(com.apple.foundationdb.record.query.plan.temp.AliasMap, com.apple.foundationdb.record.query.plan.temp.MatchCandidate, com.apple.foundationdb.record.query.plan.temp.RelationalExpression, com.apple.foundationdb.record.query.plan.temp.ExpressionRef<? extends com.apple.foundationdb.record.query.plan.temp.RelationalExpression>, com.apple.foundationdb.record.query.plan.temp.MatchInfo)
to either declare a new resulting expression or to declare a new partial match between the current expression and some candidate expression.
-
-
Constructor Summary
Constructors Constructor Description CascadesRuleCall(PlanContext context, PlannerRule<? extends Bindable> rule, GroupExpressionRef<RelationalExpression> root, Quantifiers.AliasResolver aliasResolver, PlannerBindings bindings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Quantifiers.AliasResolver
getAliasResolver()
Returns the alias resolver that is currently in use and maintained by the planner.PlannerBindings
getBindings()
Return the map of bindings that this rule's matcher expression produced, which includes (by contract) all of the bindings specified by the rule associated with this call.PlanContext
getContext()
Get the planning context with metadata that might be relevant to the planner, such as the list of available indexes.Collection<RelationalExpression>
getNewExpressions()
Set<PartialMatch>
getNewPartialMatches()
<U extends RelationalExpression>
ExpressionRef<U>ref(U expression)
Wrap the given planner expression in an implementation ofExpressionRef
suitable for the planner associated with this rule.void
run()
void
yield(ExpressionRef<? extends RelationalExpression> expression)
Notify the planner's data structures that the new expression contained inexpression
has been produced by the rule.void
yieldPartialMatch(AliasMap boundAliasMap, MatchCandidate matchCandidate, RelationalExpression queryExpression, ExpressionRef<? extends RelationalExpression> candidateRef, MatchInfo matchInfo)
Notify the planner's data structures that a new partial match has been produced by the rule.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.PlannerRuleCall
get
-
-
-
-
Constructor Detail
-
CascadesRuleCall
public CascadesRuleCall(@Nonnull PlanContext context, @Nonnull PlannerRule<? extends Bindable> rule, @Nonnull GroupExpressionRef<RelationalExpression> root, @Nonnull Quantifiers.AliasResolver aliasResolver, @Nonnull PlannerBindings bindings)
-
-
Method Detail
-
run
public void run()
-
getAliasResolver
@Nonnull public Quantifiers.AliasResolver getAliasResolver()
Description copied from interface:PlannerRuleCall
Returns the alias resolver that is currently in use and maintained by the planner.- Specified by:
getAliasResolver
in interfacePlannerRuleCall
- Returns:
- the alias resolver
-
getBindings
@Nonnull public PlannerBindings getBindings()
Description copied from interface:PlannerRuleCall
Return the map of bindings that this rule's matcher expression produced, which includes (by contract) all of the bindings specified by the rule associated with this call. This method should be implemented by rule call implementations, but users of the rule should usually access these viaPlannerRuleCall.get(ExpressionMatcher)
.- Specified by:
getBindings
in interfacePlannerRuleCall
- Returns:
- the map of bindings that the rule's matcher expression produced
-
getContext
@Nonnull public PlanContext getContext()
Description copied from interface:PlannerRuleCall
Get the planning context with metadata that might be relevant to the planner, such as the list of available indexes.- Specified by:
getContext
in interfacePlannerRuleCall
- Returns:
- a
PlanContext
object with various metadata that could affect planning
-
yield
public void yield(@Nonnull ExpressionRef<? extends RelationalExpression> expression)
Description copied from interface:PlannerRuleCall
Notify the planner's data structures that the new expression contained inexpression
has been produced by the rule. This method may be called zero or more times by the rule'sonMatch()
method.- Specified by:
yield
in interfacePlannerRuleCall
- Parameters:
expression
- the expression produced by the rule
-
yieldPartialMatch
public void yieldPartialMatch(@Nonnull AliasMap boundAliasMap, @Nonnull MatchCandidate matchCandidate, @Nonnull RelationalExpression queryExpression, @Nonnull ExpressionRef<? extends RelationalExpression> candidateRef, @Nonnull MatchInfo matchInfo)
Description copied from interface:PlannerRuleCall
Notify the planner's data structures that a new partial match has been produced by the rule. This method may be called zero or more times by the rule'sonMatch()
method.- Specified by:
yieldPartialMatch
in interfacePlannerRuleCall
- Parameters:
boundAliasMap
- the alias map of bound correlated identifiers between query and candidatematchCandidate
- the match candidatequeryExpression
- the query expressioncandidateRef
- the matching reference on the candidate sidematchInfo
- an auxiliary structure to keep additional information about the match
-
ref
public <U extends RelationalExpression> ExpressionRef<U> ref(U expression)
Description copied from interface:PlannerRuleCall
Wrap the given planner expression in an implementation ofExpressionRef
suitable for the planner associated with this rule. Different rule call implementations might use different reference types depending on the specifics of the associated planner.- Specified by:
ref
in interfacePlannerRuleCall
- Type Parameters:
U
- the type of the planner expression- Parameters:
expression
- the planner expression to wrap in a reference type- Returns:
expression
wrapped in a reference
-
getNewExpressions
@Nonnull public Collection<RelationalExpression> getNewExpressions()
-
getNewPartialMatches
@Nonnull public Set<PartialMatch> getNewPartialMatches()
-
-