org.modeshape.graph.query.optimize
Class AddJoinConditionColumnsToSources

java.lang.Object
  extended by org.modeshape.graph.query.optimize.AddJoinConditionColumnsToSources
All Implemented Interfaces:
OptimizerRule

public class AddJoinConditionColumnsToSources
extends Object
implements OptimizerRule

An OptimizerRule that adds any missing columns required by the join conditions to the appropriate join source.


Field Summary
static AddJoinConditionColumnsToSources INSTANCE
           
 
Constructor Summary
AddJoinConditionColumnsToSources()
           
 
Method Summary
protected  void addEquiJoinColumn(QueryContext context, PlanNode node, Column joinColumn)
          Make sure that the supplied column is included in the projected columns on the supplied plan node or its children.
protected  boolean addIfMissing(QueryContext context, Column column, List<Column> columns, List<String> columnTypes)
          Check the supplied list of columns for an existing column that matches the supplied Column, and if none is found add the supplied Column to the list and add an appropriate type.
protected  Column columnFor(SelectorName selector, String property)
           
 PlanNode execute(QueryContext context, PlanNode plan, LinkedList<OptimizerRule> ruleStack)
          Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final AddJoinConditionColumnsToSources INSTANCE
Constructor Detail

AddJoinConditionColumnsToSources

public AddJoinConditionColumnsToSources()
Method Detail

execute

public PlanNode execute(QueryContext context,
                        PlanNode plan,
                        LinkedList<OptimizerRule> ruleStack)
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
See Also:
OptimizerRule.execute(org.modeshape.graph.query.QueryContext, org.modeshape.graph.query.plan.PlanNode, java.util.LinkedList)

addEquiJoinColumn

protected void addEquiJoinColumn(QueryContext context,
                                 PlanNode node,
                                 Column joinColumn)
Make sure that the supplied column is included in the projected columns on the supplied plan node or its children.

Parameters:
context - the query context; may not be null
node - the query plan node
joinColumn - the column required by the join

addIfMissing

protected boolean addIfMissing(QueryContext context,
                               Column column,
                               List<Column> columns,
                               List<String> columnTypes)
Check the supplied list of columns for an existing column that matches the supplied Column, and if none is found add the supplied Column to the list and add an appropriate type.

Parameters:
context - the query context
column - the column that will be added if not already in the list; may not be null
columns - the list of columns; may not be null
columnTypes - the list of column types; may not be null
Returns:
true if the column was added (i.e., the lists were modified), or false if the lists were not modified

columnFor

protected Column columnFor(SelectorName selector,
                           String property)


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