Package org.apache.calcite.plan
Class SubstitutionVisitor.UnifyRule
- java.lang.Object
-
- org.apache.calcite.plan.SubstitutionVisitor.UnifyRule
-
- Direct Known Subclasses:
SubstitutionVisitor.AbstractUnifyRule
- Enclosing class:
- SubstitutionVisitor
protected abstract static class SubstitutionVisitor.UnifyRule extends java.lang.Object
Rule that attempts to match a query relational expression against a target relational expression.The rule declares the query and target types; this allows the engine to fire only a few rules in a given context.
-
-
Field Summary
Fields Modifier and Type Field Description protected SubstitutionVisitor.Operand
queryOperand
protected int
slotCount
protected SubstitutionVisitor.Operand
targetOperand
-
Constructor Summary
Constructors Modifier Constructor Description protected
UnifyRule(int slotCount, SubstitutionVisitor.Operand queryOperand, SubstitutionVisitor.Operand targetOperand)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract SubstitutionVisitor.UnifyResult
apply(SubstitutionVisitor.UnifyRuleCall call)
Applies this rule to a particular node in a query.protected <E> com.google.common.collect.ImmutableList<E>
copy(E[] slots, int slotCount)
protected SubstitutionVisitor.UnifyRuleCall
match(SubstitutionVisitor visitor, MutableRel query, MutableRel target)
-
-
-
Field Detail
-
slotCount
protected final int slotCount
-
queryOperand
protected final SubstitutionVisitor.Operand queryOperand
-
targetOperand
protected final SubstitutionVisitor.Operand targetOperand
-
-
Constructor Detail
-
UnifyRule
protected UnifyRule(int slotCount, SubstitutionVisitor.Operand queryOperand, SubstitutionVisitor.Operand targetOperand)
-
-
Method Detail
-
apply
protected abstract SubstitutionVisitor.UnifyResult apply(SubstitutionVisitor.UnifyRuleCall call)
Applies this rule to a particular node in a query. The goal is to convert
query
intotarget
. Before the rule is invoked, Calcite has made sure that query's children are equivalent to target's children.There are 3 possible outcomes:
query
already exactly matchestarget
; returnstarget
query
is sufficiently close to a match fortarget
; returnstarget
query
cannot be made to matchtarget
; returns null
REVIEW: Is possible that we match query PLUS one or more of its ancestors?
- Parameters:
call
- Input parameters
-
match
protected SubstitutionVisitor.UnifyRuleCall match(SubstitutionVisitor visitor, MutableRel query, MutableRel target)
-
copy
protected <E> com.google.common.collect.ImmutableList<E> copy(E[] slots, int slotCount)
-
-