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.
INSTANCE
public static final RewriteIdentityJoins INSTANCE
RewriteIdentityJoins
public RewriteIdentityJoins()
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 nullplan
- the plan to be optimized; never nullruleStack
- 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
Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.