com.lucidera.opt
Class LoptModifyRemovableSelfJoinRule

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRule
      extended by com.lucidera.opt.LoptModifyRemovableSelfJoinRule

public class LoptModifyRemovableSelfJoinRule
extends RelOptRule

LoptModifyRemovableSelfJoinRule implements a rule that modifies the inputs into a removable self-join so that they are in a standard format that will be recognized by LoptRemoveSelfJoinRule.

Each input into the join is already a simple LcsRowScanRel. There needs to be a FilterRel and ProjectRel on top of each of the row scans. So, this rule adds the missing ProjectRel and/or FilterRel. The FilterRel contains a dummy IS TRUE expression while the ProjectRel simply projects each column. Both will be removed later by LoptRemoveSelfJoinRule.

Version:
$Id: //open/dev/farrago/src/com/lucidera/opt/LoptModifyRemovableSelfJoinRule.java#5 $
Author:
Zelaine Fong

Field Summary
static LoptModifyRemovableSelfJoinRule instanceFilterOnLeft
           
static LoptModifyRemovableSelfJoinRule instanceFilterOnRight
           
static LoptModifyRemovableSelfJoinRule instanceProjectOnLeft
           
static LoptModifyRemovableSelfJoinRule instanceProjectOnRight
           
static LoptModifyRemovableSelfJoinRule instanceRowScanOnLeft
           
static LoptModifyRemovableSelfJoinRule instanceRowScanOnRight
           
 
Fields inherited from class org.eigenbase.relopt.RelOptRule
ANY, description, operands
 
Constructor Summary
LoptModifyRemovableSelfJoinRule(RelOptRuleOperand operand, String id)
          Creates a LoptModifyRemovableSelfJoinRule.
 
Method Summary
private  ProjectRel addFilter(ProjectRel projRel)
          Inserts a FilterRel with a TRUE condition in between a ProjectRel and its input.
private  ProjectRel addProject(RelNode filterRel)
          Inserts a ProjectRel on top of a filter node.
private  ProjectRel addProjectAndFilter(RelNode rowScan)
          Inserts a ProjectRel and FilterRel on top of a row scan.
 void onMatch(RelOptRuleCall call)
          Receives notification about a rule match.
 
Methods inherited from class org.eigenbase.relopt.RelOptRule
convert, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instanceRowScanOnLeft

public static final LoptModifyRemovableSelfJoinRule instanceRowScanOnLeft

instanceRowScanOnRight

public static final LoptModifyRemovableSelfJoinRule instanceRowScanOnRight

instanceFilterOnLeft

public static final LoptModifyRemovableSelfJoinRule instanceFilterOnLeft

instanceProjectOnLeft

public static final LoptModifyRemovableSelfJoinRule instanceProjectOnLeft

instanceFilterOnRight

public static final LoptModifyRemovableSelfJoinRule instanceFilterOnRight

instanceProjectOnRight

public static final LoptModifyRemovableSelfJoinRule instanceProjectOnRight
Constructor Detail

LoptModifyRemovableSelfJoinRule

public LoptModifyRemovableSelfJoinRule(RelOptRuleOperand operand,
                                       String id)
Creates a LoptModifyRemovableSelfJoinRule.

Parameters:
operand - Root operand, must not be null
id - Description of rule
Method Detail

onMatch

public void onMatch(RelOptRuleCall call)
Description copied from class: RelOptRule
Receives notification about a rule match. At the time that this method is called, call.rels holds the set of relational expressions which match the operands to the rule; call.rels[0] is the root expression.

Typically a rule would check that the nodes are valid matches, creates a new expression, then calls back RelOptRuleCall.transformTo(org.eigenbase.rel.RelNode) to register the expression.

Specified by:
onMatch in class RelOptRule
Parameters:
call - Rule call
See Also:
RelOptRule.matches(RelOptRuleCall)

addProjectAndFilter

private ProjectRel addProjectAndFilter(RelNode rowScan)
Inserts a ProjectRel and FilterRel on top of a row scan.

Parameters:
rowScan - the row scan
Returns:
the constructed RelNode tree

addProject

private ProjectRel addProject(RelNode filterRel)
Inserts a ProjectRel on top of a filter node.

Parameters:
filterRel - the filter node
Returns:
the constructed ProjectRel tree

addFilter

private ProjectRel addFilter(ProjectRel projRel)
Inserts a FilterRel with a TRUE condition in between a ProjectRel and its input.

Parameters:
projRel - the ProjectRel
Returns:
the constructed RelNode tree