org.eigenbase.relopt
Class RelOptRuleCall

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRuleCall
Direct Known Subclasses:
HepRuleCall, MockRelOptPlanner.MockRuleCall, Rex2CalcPlanTest.TesterImpl.MyRelOptRuleCall, VolcanoRuleCall

public abstract class RelOptRuleCall
extends Object

A RelOptRuleCall is an invocation of a RelOptRule with a set of relational expressions as arguments.


Field Summary
private  Map<RelNode,List<RelNode>> nodeChildren
           
private  RelOptRuleOperand operand0
           
private  List<RelNode> parents
           
private  RelOptPlanner planner
           
 RelNode[] rels
           
private  RelOptRule rule
           
protected static Logger tracer
           
 
Constructor Summary
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode,List<RelNode>> nodeChildren)
           
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode,List<RelNode>> nodeChildren, List<RelNode> parents)
          Creates a RelOptRuleCall.
 
Method Summary
 List<RelNode> getChildRels(RelNode rel)
          Returns the children of a given relational expression node matched in a rule.
 RelOptRuleOperand getOperand0()
          Returns the root operand matched by this rule.
 List<RelNode> getParents()
           
 RelOptPlanner getPlanner()
          Returns the planner.
 RelNode[] getRels()
          Returns a list of matched relational expressions.
 RelOptRule getRule()
          Returns the invoked planner rule.
abstract  void transformTo(RelNode rel)
          Called by the rule whenever it finds a match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tracer

protected static final Logger tracer

operand0

private final RelOptRuleOperand operand0

nodeChildren

private final Map<RelNode,List<RelNode>> nodeChildren

rule

private final RelOptRule rule

rels

public final RelNode[] rels

planner

private final RelOptPlanner planner

parents

private final List<RelNode> parents
Constructor Detail

RelOptRuleCall

protected RelOptRuleCall(RelOptPlanner planner,
                         RelOptRuleOperand operand,
                         RelNode[] rels,
                         Map<RelNode,List<RelNode>> nodeChildren,
                         List<RelNode> parents)
Creates a RelOptRuleCall.

Parameters:
planner - Planner
operand - Root operand
rels - Array of relational expressions which matched each operand
nodeChildren - For each node which matched with matchAnyChildren=true, a list of the node's children
parents - list of parent RelNodes corresponding to the first relational expression in the array argument, if known; otherwise, null

RelOptRuleCall

protected RelOptRuleCall(RelOptPlanner planner,
                         RelOptRuleOperand operand,
                         RelNode[] rels,
                         Map<RelNode,List<RelNode>> nodeChildren)
Method Detail

getOperand0

public RelOptRuleOperand getOperand0()
Returns the root operand matched by this rule.

Returns:
root operand

getRule

public RelOptRule getRule()
Returns the invoked planner rule.

Returns:
planner rule

getRels

public RelNode[] getRels()
Returns a list of matched relational expressions.

Returns:
matched relational expressions

getChildRels

public List<RelNode> getChildRels(RelNode rel)
Returns the children of a given relational expression node matched in a rule.

If the operand which caused the match has RelOptRuleOperand.matchAnyChildren=false, the children will have their own operands and therefore be easily available in the array returned by the getRels() method, so this method returns null.

This method is for RelOptRuleOperand.matchAnyChildren=true, which is generally used when a node can have a variable number of children, and hence where the matched children are not retrievable by any other means.

Parameters:
rel - Relational expression
Returns:
Children of relational expression

getPlanner

public RelOptPlanner getPlanner()
Returns the planner.

Returns:
planner

getParents

public List<RelNode> getParents()
Returns:
list of parents of the first relational expression

transformTo

public abstract void transformTo(RelNode rel)
Called by the rule whenever it finds a match. The implementation of this method will guarantee that the original relational expression (e.g., this.rels[0]) has its traits propagated to the new relational expression (rel) and its unregistered children. Any trait not specifically set in the RelTraitSet returned by rel.getTraits() will be copied from this.rels[0].getTraitSet().