org.eigenbase.relopt.volcano
Class VolcanoRuleMatch

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRuleCall
      extended by org.eigenbase.relopt.volcano.VolcanoRuleCall
          extended by org.eigenbase.relopt.volcano.VolcanoRuleMatch

 class VolcanoRuleMatch
extends VolcanoRuleCall

A match of a rule to a particular set of target relational expressions, frozen in time.

Since:
Jun 14, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/relopt/volcano/VolcanoRuleMatch.java#2 $
Author:
jhyde

Field Summary
private  double cachedImportance
           
private  String digest
           
private  RelSet targetSet
           
private  RelSubset targetSubset
           
private  VolcanoPlanner volcanoPlanner
           
 
Fields inherited from class org.eigenbase.relopt.RelOptRuleCall
rels, tracer
 
Constructor Summary
VolcanoRuleMatch(VolcanoPlanner volcanoPlanner, RelOptRuleOperand operand0, RelNode[] rels)
          Creates a VolcanoRuleMatch.
 
Method Summary
(package private)  void clearCachedImportance()
          Clears the cached importance value of this rule match.
private  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.
 String toString()
           
 
Methods inherited from class org.eigenbase.relopt.volcano.VolcanoRuleCall
match, onMatch, transformTo
 
Methods inherited from class org.eigenbase.relopt.RelOptRuleCall
getChildRels, getOperand0, getParents, getPlanner, getRels, getRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

targetSet

private final RelSet targetSet

targetSubset

private RelSubset targetSubset

digest

private String digest

volcanoPlanner

private final VolcanoPlanner volcanoPlanner

cachedImportance

private double cachedImportance
Constructor Detail

VolcanoRuleMatch

VolcanoRuleMatch(VolcanoPlanner volcanoPlanner,
                 RelOptRuleOperand operand0,
                 RelNode[] rels)
Creates a VolcanoRuleMatch.

Parameters:
operand0 - Primary operand
rels - List of targets; copied by the constructor, so the client can modify it later
"Precondition:"
rels[i] != null
Method Detail

toString

public String toString()
Overrides:
toString in class Object

clearCachedImportance

void clearCachedImportance()
Clears the cached importance value of this rule match. The importance will be re-calculated next time getImportance() is called.


getImportance

double getImportance()
Returns the importance of this rule.

Calls computeImportance() the first time, thereafter uses a cached value until clearCachedImportance() 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 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