org.eigenbase.rel.rules
Class PullUpProjectsOnTopOfMultiJoinRule
java.lang.Object
org.eigenbase.relopt.RelOptRule
org.eigenbase.rel.rules.PullUpProjectsAboveJoinRule
org.eigenbase.rel.rules.PullUpProjectsOnTopOfMultiJoinRule
public class PullUpProjectsOnTopOfMultiJoinRule
- extends PullUpProjectsAboveJoinRule
PullUpProjectsOnTopOfMultiJoinRule implements the rule for pulling ProjectRel
s that are on top of a MultiJoinRel
and beneath a JoinRel
so the ProjectRel
appears above the JoinRel
. In the
process of doing so, also save away information about the respective fields
that are referenced in the expressions in the ProjectRel
we're
pulling up, as well as the join condition, in the resultant MultiJoinRel
s
For example, if we have the following subselect:
(select X.x1, Y.y1 from X, Y
where X.x2 = Y.y2 and X.x3 = 1 and Y.y3 = 2)
The MultiJoinRel
associated with (X, Y) associates x1 with X and
y1 with Y. Although x3 and y3 need to be read due to the filters, they are
not required after the row scan has completed and therefore are not saved.
The join fields, x2 and y2, are also tracked separately.
Note that by only pulling up projects that are on top of MultiJoinRel
s, we preserve projections on top of row scans.
See the superclass for details on restrictions regarding which ProjectRel
s cannot be pulled.
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/rel/rules/PullUpProjectsOnTopOfMultiJoinRule.java#7 $
- Author:
- Zelaine Fong
Methods inherited from class org.eigenbase.relopt.RelOptRule |
convert, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString |
instanceTwoProjectChildren
public static final PullUpProjectsOnTopOfMultiJoinRule instanceTwoProjectChildren
instanceLeftProjectChild
public static final PullUpProjectsOnTopOfMultiJoinRule instanceLeftProjectChild
instanceRightProjectChild
public static final PullUpProjectsOnTopOfMultiJoinRule instanceRightProjectChild
PullUpProjectsOnTopOfMultiJoinRule
public PullUpProjectsOnTopOfMultiJoinRule(RelOptRuleOperand operand,
String description)
hasLeftChild
protected boolean hasLeftChild(RelOptRuleCall call)
- Overrides:
hasLeftChild
in class PullUpProjectsAboveJoinRule
- Parameters:
call
- RelOptRuleCall
- Returns:
- true if the rule was invoked with a left project child
hasRightChild
protected boolean hasRightChild(RelOptRuleCall call)
- Overrides:
hasRightChild
in class PullUpProjectsAboveJoinRule
- Parameters:
call
- RelOptRuleCall
- Returns:
- true if the rule was invoked with 2 children
getRightChild
protected ProjectRel getRightChild(RelOptRuleCall call)
- Overrides:
getRightChild
in class PullUpProjectsAboveJoinRule
- Parameters:
call
- RelOptRuleCall
- Returns:
- ProjectRel corresponding to the right child
getProjectChild
protected RelNode getProjectChild(RelOptRuleCall call,
ProjectRel project,
boolean leftChild)
- Description copied from class:
PullUpProjectsAboveJoinRule
- Returns the child of the project that will be used as input into the new
JoinRel once the projects are pulled above the JoinRel.
- Overrides:
getProjectChild
in class PullUpProjectsAboveJoinRule
- Parameters:
call
- RelOptRuleCallproject
- project RelNodeleftChild
- true if the project corresponds to the left projection
- Returns:
- child of the project that will be used as input into the new
JoinRel once the projects are pulled above the JoinRel