Package org.apache.calcite.plan.volcano
Class VolcanoRuleMatch
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRuleCall
-
- org.apache.calcite.plan.volcano.VolcanoRuleCall
-
- org.apache.calcite.plan.volcano.VolcanoRuleMatch
-
class VolcanoRuleMatch extends VolcanoRuleCall
A match of a rule to a particular set of target relational expressions, frozen in time.
-
-
Field Summary
Fields Modifier and Type Field Description private double
cachedImportance
private java.lang.String
digest
private RelSet
targetSet
private RelSubset
targetSubset
-
Fields inherited from class org.apache.calcite.plan.volcano.VolcanoRuleCall
volcanoPlanner
-
Fields inherited from class org.apache.calcite.plan.RelOptRuleCall
id, LOGGER, nodeInputs, operand0, rels, rule
-
-
Constructor Summary
Constructors Constructor Description VolcanoRuleMatch(VolcanoPlanner volcanoPlanner, RelOptRuleOperand operand0, RelNode[] rels, java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs)
Creates aVolcanoRuleMatch
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <E> boolean
allNotNull(E[] es, Litmus litmus)
Returns whether all elements of a given array are not-null; fails if any are null.(package private) void
clearCachedImportance()
Clears the cached importance value of this rule match.private java.lang.String
computeDigest()
Computes a string describing this rule match.(package private) double
computeImportance()
Computes the importance of this rule match.(package private) double
getImportance()
Returns the importance of this rule.private RelSubset
guessSubset()
Returns a guess as to which subset (that is equivalence class of relational expressions combined with a set of physical traits) the result of this rule will belong to.void
recomputeDigest()
Recomputes the digest of this VolcanoRuleMatch.java.lang.String
toString()
-
Methods inherited from class org.apache.calcite.plan.volcano.VolcanoRuleCall
match, onMatch, transformTo
-
Methods inherited from class org.apache.calcite.plan.RelOptRuleCall
builder, getChildRels, getMetadataQuery, getOperand0, getParents, getPlanner, getRelList, getRels, getRule, rel, setChildRels, transformTo
-
-
-
-
Constructor Detail
-
VolcanoRuleMatch
VolcanoRuleMatch(VolcanoPlanner volcanoPlanner, RelOptRuleOperand operand0, RelNode[] rels, java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs)
Creates aVolcanoRuleMatch
.- Parameters:
operand0
- Primary operandrels
- List of targets; copied by the constructor, so the client can modify it laternodeInputs
- Map from relational expressions to their inputs
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clearCachedImportance
void clearCachedImportance()
Clears the cached importance value of this rule match. The importance will be re-calculated next timegetImportance()
is called.
-
getImportance
double getImportance()
Returns the importance of this rule.Calls
computeImportance()
the first time, thereafter uses a cached value untilclearCachedImportance()
is called.- Returns:
- importance of this rule; a value between 0 and 1
-
computeImportance
double computeImportance()
Computes the importance of this rule match.- Returns:
- importance of this rule match
-
computeDigest
private java.lang.String computeDigest()
Computes a string describing this rule match. Two rule matches are equivalent if and only if their digests are the same.- Returns:
- description of this rule match
-
recomputeDigest
public void recomputeDigest()
Recomputes the digest of this VolcanoRuleMatch. It is necessary when sets have merged since the match was created.
-
guessSubset
private RelSubset guessSubset()
Returns a guess as to which subset (that is equivalence class of relational expressions combined with a set of physical traits) the result of this rule will belong to.- Returns:
- expected subset, or null if we cannot guess
-
allNotNull
private static <E> boolean allNotNull(E[] es, Litmus litmus)
Returns whether all elements of a given array are not-null; fails if any are null.
-
-