saffron.opt
Class RelSubset

java.lang.Object
  |
  +--saffron.rel.Rel
        |
        +--saffron.opt.RelSubset

public class RelSubset
extends Rel

A RelSubset is set of expressions in a set which have the same calling convention. An expression may be in more than one sub-set of a set; the same expression is used.

Since:
16 December, 2001
Version:
$Id: //open/saffron/src/main/saffron/opt/RelSubset.java#8 $
Author:
jhyde

Nested Class Summary
(package private)  class RelSubset.CheapestPlanReplacer
          Visitor which walks over a tree of RelSets, replacing each node with the cheapest implementation of the expression.
 
Nested classes inherited from class saffron.rel.Rel
 
Field Summary
(package private)  boolean active
          whether findBestPlan is being called
(package private)  Rel best
          best known plan
(package private)  Cost bestCost
          cost of best known plan (it may have improved since)
(package private)  CallingConvention convention
           
(package private)  ArrayList parents
          List of the relational expressions for which this subset is an input.
(package private)  ArrayList rels
           
(package private)  RelSet set
           
 
Fields inherited from class saffron.rel.Rel
cluster, digest, id, rowType
 
Constructor Summary
(package private) RelSubset(Cluster cluster, RelSet set, CallingConvention convention)
           
 
Method Summary
(package private)  void add(Rel rel)
          Add expression rel to this subset.
(package private)  Rel buildCheapestPlan(Planner planner)
          Recursively build a tree consisting of the cheapest plan at each node.
 Object clone()
          An RelSet is its own clone.
protected  String computeDigest()
          Computes the digest.
 Cost computeSelfCost(Planner planner)
          Returns the cost of this plan (not including children).
protected  Type deriveRowType()
           
 void explain(PlanWriter pw)
           
 CallingConvention getConvention()
          Returns a value from CallingConvention.
 Rel[] getInputs()
          There are no children, as such.
(package private)  ArrayList getParentRels()
           
(package private)  Set getParentSubsets()
           
(package private)  RelSet getSet()
           
 Set getVariablesSet()
           
 Set getVariablesUsed()
           
private  void propagateCostImprovements(VolcanoPlanner planner, Rel rel)
          Checks whether a relexp has made its subset cheaper, and if it so, recursively checks whether that subset's parents have gotten cheaper.
 
Methods inherited from class saffron.rel.Rel
childrenAccept, getChildExps, getCluster, getCorelVariable, getEnvironment, getId, getInput, getOrCreateCorelVariable, getParentEnv, getQualifier, getQuery, getRelTypeName, getRows, getRowType, getTable, getType, getVariablesStopped, implement, implementExp, implementExps, implementFieldAccess, implementSelf, isAccessTo, isDistinct, onRegister, recomputeDigest, register, registerCorelVariable, replaceInput, setCorelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

set

RelSet set

convention

CallingConvention convention

rels

ArrayList rels

parents

ArrayList parents
List of the relational expressions for which this subset is an input.


bestCost

Cost bestCost
cost of best known plan (it may have improved since)


best

Rel best
best known plan


active

boolean active
whether findBestPlan is being called

Constructor Detail

RelSubset

RelSubset(Cluster cluster,
          RelSet set,
          CallingConvention convention)
Method Detail

getSet

RelSet getSet()

getParentRels

ArrayList getParentRels()

getParentSubsets

Set getParentSubsets()

add

void add(Rel rel)
Add expression rel to this subset.


propagateCostImprovements

private void propagateCostImprovements(VolcanoPlanner planner,
                                       Rel rel)
Checks whether a relexp has made its subset cheaper, and if it so, recursively checks whether that subset's parents have gotten cheaper.


clone

public Object clone()
An RelSet is its own clone.

Specified by:
clone in class Rel

computeDigest

protected String computeDigest()
Description copied from class: Rel
Computes the digest. Does not modify this object.

Overrides:
computeDigest in class Rel

getInputs

public Rel[] getInputs()
There are no children, as such. We throw an exception because you probably don't want to be walking over trees which contain RelSets.

Overrides:
getInputs in class Rel

deriveRowType

protected Type deriveRowType()
Specified by:
deriveRowType in class Rel

computeSelfCost

public Cost computeSelfCost(Planner planner)
Description copied from class: Rel
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.

Overrides:
computeSelfCost in class Rel

explain

public void explain(PlanWriter pw)
Overrides:
explain in class Rel

getConvention

public CallingConvention getConvention()
Description copied from class: Rel
Returns a value from CallingConvention.

Overrides:
getConvention in class Rel

getVariablesSet

public Set getVariablesSet()

getVariablesUsed

public Set getVariablesUsed()

buildCheapestPlan

Rel buildCheapestPlan(Planner planner)
Recursively build a tree consisting of the cheapest plan at each node.


SourceForge.net_Logo