net.sf.saffron.opt
Class RelSubset

java.lang.Object
  |
  +--net.sf.saffron.rel.SaffronRel
        |
        +--net.sf.saffron.opt.RelSubset

public class RelSubset
extends SaffronRel

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/net/sf/saffron/opt/RelSubset.java#5 $
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.
 
Field Summary
(package private)  boolean active
          whether findBestPlan is being called
(package private)  SaffronRel best
          best known plan
(package private)  PlanCost 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 net.sf.saffron.rel.SaffronRel
cluster, digest, id, rowType
 
Constructor Summary
(package private) RelSubset(VolcanoCluster cluster, RelSet set, CallingConvention convention)
           
 
Method Summary
(package private)  void add(SaffronRel rel)
          Add expression rel to this subset.
(package private)  SaffronRel buildCheapestPlan(SaffronPlanner 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.
 PlanCost computeSelfCost(SaffronPlanner planner)
          Returns the cost of this plan (not including children).
protected  SaffronType deriveRowType()
           
 void explain(PlanWriter pw)
           
 CallingConvention getConvention()
          Returns a value from CallingConvention.
 SaffronRel[] 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, SaffronRel 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 net.sf.saffron.rel.SaffronRel
childrenAccept, getChildExps, getCluster, getCorrelVariable, getId, getInput, getOrCreateCorrelVariable, getQualifier, getQuery, getRelTypeName, getRows, getRowType, getTable, getVariablesStopped, implement, implementFieldAccess, isAccessTo, isDistinct, onRegister, recomputeDigest, register, registerCorrelVariable, replaceInput, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parents

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


rels

ArrayList rels

convention

CallingConvention convention

bestCost

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


set

RelSet set

best

SaffronRel best
best known plan


active

boolean active
whether findBestPlan is being called

Constructor Detail

RelSubset

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

getConvention

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

Overrides:
getConvention in class SaffronRel

getInputs

public SaffronRel[] 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 SaffronRel

getVariablesSet

public Set getVariablesSet()

getVariablesUsed

public Set getVariablesUsed()

clone

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

Specified by:
clone in class SaffronRel

computeSelfCost

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

Overrides:
computeSelfCost in class SaffronRel

explain

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

computeDigest

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

Overrides:
computeDigest in class SaffronRel

deriveRowType

protected SaffronType deriveRowType()
Specified by:
deriveRowType in class SaffronRel

getParentRels

ArrayList getParentRels()

getParentSubsets

Set getParentSubsets()

getSet

RelSet getSet()

add

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


buildCheapestPlan

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


propagateCostImprovements

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


SourceForge.net_Logo