Package org.apache.calcite.rel.rules
Class JoinCommuteRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.rel.rules.JoinCommuteRule
-
public class JoinCommuteRule extends RelOptRule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JoinCommuteRule.VariableReplacer
Walks over an expression, replacing references to fields of the left and right inputs.
-
Field Summary
Fields Modifier and Type Field Description static JoinCommuteRule
INSTANCE
Instance of the rule that only swaps inner joins.static JoinCommuteRule
SWAP_OUTER
Instance of the rule that swaps outer joins as well as inner joins.private boolean
swapOuter
-
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description private
JoinCommuteRule(boolean swapOuter)
JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelFactories.ProjectFactory projectFactory)
Deprecated.JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelFactories.ProjectFactory projectFactory, boolean swapOuter)
Deprecated.JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelBuilderFactory relBuilderFactory, boolean swapOuter)
Creates a JoinCommuteRule.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
onMatch(RelOptRuleCall call)
Receives notification about a rule match.static RelNode
swap(Join join)
Deprecated.static RelNode
swap(Join join, boolean swapOuterJoins)
Deprecated.static RelNode
swap(Join join, boolean swapOuterJoins, RelBuilder relBuilder)
Returns a relational expression with the inputs switched round.-
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
-
INSTANCE
public static final JoinCommuteRule INSTANCE
Instance of the rule that only swaps inner joins.
-
SWAP_OUTER
public static final JoinCommuteRule SWAP_OUTER
Instance of the rule that swaps outer joins as well as inner joins.
-
swapOuter
private final boolean swapOuter
-
-
Constructor Detail
-
JoinCommuteRule
public JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelBuilderFactory relBuilderFactory, boolean swapOuter)
Creates a JoinCommuteRule.
-
JoinCommuteRule
private JoinCommuteRule(boolean swapOuter)
-
JoinCommuteRule
@Deprecated public JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelFactories.ProjectFactory projectFactory)
Deprecated.
-
JoinCommuteRule
@Deprecated public JoinCommuteRule(java.lang.Class<? extends Join> clazz, RelFactories.ProjectFactory projectFactory, boolean swapOuter)
Deprecated.
-
-
Method Detail
-
swap
public static RelNode swap(Join join, boolean swapOuterJoins, RelBuilder relBuilder)
Returns a relational expression with the inputs switched round. Does not modifyjoin
. Returns null if the join cannot be swapped (for example, because it is an outer join).- Parameters:
join
- join to be swappedswapOuterJoins
- whether outer joins should be swappedrelBuilder
- Builder for relational expressions- Returns:
- swapped join if swapping possible; else null
-
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.apache.calcite.rel.RelNode, java.util.Map<org.apache.calcite.rel.RelNode, org.apache.calcite.rel.RelNode>)
to register the expression.- Specified by:
onMatch
in classRelOptRule
- Parameters:
call
- Rule call- See Also:
RelOptRule.matches(RelOptRuleCall)
-
-