org.eigenbase.rel.rules
Class SwapJoinRule

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRule
      extended by org.eigenbase.rel.rules.SwapJoinRule

public class SwapJoinRule
extends RelOptRule

SwapJoinRule permutes the inputs to a join. Outer joins cannot be permuted.

Since:
Nov 26, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/rules/SwapJoinRule.java#3 $
Author:
jhyde

Nested Class Summary
private static class SwapJoinRule.VariableReplacer
          Walks over an expression, replacing references to fields of the left and right inputs.
 
Field Summary
static SwapJoinRule instance
          The singleton
 
Fields inherited from class org.eigenbase.relopt.RelOptRule
ANY, description, operands
 
Constructor Summary
private SwapJoinRule()
          Creates a SwapJoinRule.
 
Method Summary
 void onMatch(RelOptRuleCall call)
          Receives notification about a rule match.
static RelNode swap(JoinRel join)
          Returns a relational expression with the inputs switched round.
static RelNode swap(JoinRel join, boolean swapOuterJoins)
           
 
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

instance

public static final SwapJoinRule instance
The singleton

Constructor Detail

SwapJoinRule

private SwapJoinRule()
Creates a SwapJoinRule.

Method Detail

swap

public static RelNode swap(JoinRel join)
Returns a relational expression with the inputs switched round. Does not modify join. Returns null if the join cannot be swapped (for example, because it is an outer join).


swap

public static RelNode swap(JoinRel join,
                           boolean swapOuterJoins)
Parameters:
join - join to be swapped
swapOuterJoins - whether outer joins should be swapped
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.eigenbase.rel.RelNode) to register the expression.

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