Class MultiJoinProjectTransposeRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.rel.rules.JoinProjectTransposeRule
-
- org.apache.calcite.rel.rules.MultiJoinProjectTransposeRule
-
public class MultiJoinProjectTransposeRule extends JoinProjectTransposeRule
MultiJoinProjectTransposeRule implements the rule for pullingLogicalProject
s that are on top of aMultiJoin
and beneath aLogicalJoin
so theLogicalProject
appears above theLogicalJoin
.In the process of doing so, also save away information about the respective fields that are referenced in the expressions in the
LogicalProject
we're pulling up, as well as the join condition, in the resultantMultiJoin
sFor example, if we have the following sub-query:
(select X.x1, Y.y1 from X, Y where X.x2 = Y.y2 and X.x3 = 1 and Y.y3 = 2)
The
MultiJoin
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
MultiJoin
s, we preserve projections on top of row scans.See the superclass for details on restrictions regarding which
LogicalProject
s cannot be pulled.
-
-
Field Summary
Fields Modifier and Type Field Description static MultiJoinProjectTransposeRule
MULTI_BOTH_PROJECT
static MultiJoinProjectTransposeRule
MULTI_LEFT_PROJECT
static MultiJoinProjectTransposeRule
MULTI_RIGHT_PROJECT
-
Fields inherited from class org.apache.calcite.rel.rules.JoinProjectTransposeRule
BOTH_PROJECT, BOTH_PROJECT_INCLUDE_OUTER, LEFT_PROJECT, LEFT_PROJECT_INCLUDE_OUTER, RIGHT_PROJECT, RIGHT_PROJECT_INCLUDE_OUTER
-
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
-
Constructor Summary
Constructors Constructor Description MultiJoinProjectTransposeRule(RelOptRuleOperand operand, java.lang.String description)
Deprecated.MultiJoinProjectTransposeRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates a MultiJoinProjectTransposeRule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RelNode
getProjectChild(RelOptRuleCall call, LogicalProject project, boolean leftChild)
protected LogicalProject
getRightChild(RelOptRuleCall call)
protected boolean
hasLeftChild(RelOptRuleCall call)
protected boolean
hasRightChild(RelOptRuleCall call)
-
Methods inherited from class org.apache.calcite.rel.rules.JoinProjectTransposeRule
createProjectExprs, getProjectChild, onMatch
-
Methods inherited from class org.apache.calcite.plan.RelOptRule
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
-
-
-
Field Detail
-
MULTI_BOTH_PROJECT
public static final MultiJoinProjectTransposeRule MULTI_BOTH_PROJECT
-
MULTI_LEFT_PROJECT
public static final MultiJoinProjectTransposeRule MULTI_LEFT_PROJECT
-
MULTI_RIGHT_PROJECT
public static final MultiJoinProjectTransposeRule MULTI_RIGHT_PROJECT
-
-
Constructor Detail
-
MultiJoinProjectTransposeRule
@Deprecated public MultiJoinProjectTransposeRule(RelOptRuleOperand operand, java.lang.String description)
Deprecated.
-
MultiJoinProjectTransposeRule
public MultiJoinProjectTransposeRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates a MultiJoinProjectTransposeRule.
-
-
Method Detail
-
hasLeftChild
protected boolean hasLeftChild(RelOptRuleCall call)
- Overrides:
hasLeftChild
in classJoinProjectTransposeRule
- Parameters:
call
- RelOptRuleCall- Returns:
- true if the rule was invoked with a left project child
-
hasRightChild
protected boolean hasRightChild(RelOptRuleCall call)
- Overrides:
hasRightChild
in classJoinProjectTransposeRule
- Parameters:
call
- RelOptRuleCall- Returns:
- true if the rule was invoked with 2 children
-
getRightChild
protected LogicalProject getRightChild(RelOptRuleCall call)
- Overrides:
getRightChild
in classJoinProjectTransposeRule
- Parameters:
call
- RelOptRuleCall- Returns:
- LogicalProject corresponding to the right child
-
getProjectChild
protected RelNode getProjectChild(RelOptRuleCall call, LogicalProject project, boolean leftChild)
-
-