org.modeshape.graph.query.optimize
Class RewriteIdentityJoins

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.