Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.optimize
Class RewriteIdentityJoins

    java.lang.Object
      org.modeshape.jcr.query.optimize.RewriteIdentityJoins

All Implemented Interfaces:
  OptimizerRule

    @Immutable
    public class RewriteIdentityJoins

extends Object
implements OptimizerRule

An `optimizer rule` that rewrites JOIN nodes that have `equi-join criteria` where the columns involved in the equi-join are all identity columns (that is, they form a `key` for the table). This rewrite only happens when the left and right children of the JOIN node are both SOURCE nodes.

The basic idea is that in these identity equi-join cases, the following structure:

              ...
               |
             JOIN
            /     \
           /       \
       SOURCE     SOURCE

is transformed into a simple SOURCE node:

            ...
             |
           SOURCE

Note that this rewriting removes a selector, and thus the nodes above the JOIN node that made use of the removed selector are also modified to reference the remaining selector.

Field Summary
`static RewriteIdentityJoins` | `INSTANCE`

Constructor Summary
`RewriteIdentityJoins()`

Method Summary
`PlanNode` | `execute(QueryContext context, PlanNode plan, LinkedList<OptimizerRule> ruleStack)` Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.
`protected void` | `rewriteJoinNode(QueryContext context, PlanNode joinNode, Map<SelectorName,SelectorName> rewrittenSelectors)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### INSTANCE

    public static final RewriteIdentityJoins INSTANCE

Constructor Detail

### RewriteIdentityJoins

    public RewriteIdentityJoins()

Method Detail

### execute

    public PlanNode execute(QueryContext context,
                            PlanNode plan,
                            LinkedList<OptimizerRule> ruleStack)

  Description copied from interface: `OptimizerRule`
  Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.

  Specified by:
    `execute` in interface `OptimizerRule`
  Parameters:
    `context` - the context in which the query is being optimized; never null
    `plan` - the plan to be optimized; never null
    `ruleStack` - the stack of rules that will be run after this rule; never null
  Returns:
    the optimized plan; never null

### rewriteJoinNode

    protected void rewriteJoinNode(QueryContext context,
                                   PlanNode joinNode,
                                   Map<SelectorName,SelectorName> rewrittenSelectors)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.