Class PlanUtil

  extended by org.modeshape.graph.query.plan.PlanUtil

public class PlanUtil
extends Object

Utilities for working with PlanNodes.

Nested Class Summary
static class PlanUtil.ColumnMapping
          Defines how the view columns are mapped (or resolved) into the columns from the source tables.
protected static class PlanUtil.RequiredColumnVisitor
Constructor Summary
Method Summary
static PlanUtil.ColumnMapping createMappingFor(Schemata.View view, PlanNode viewPlan)
static PlanUtil.ColumnMapping createMappingForAliased(SelectorName tableAlias, Schemata.Table table, PlanNode tableSourceNode)
static PlanUtil.ColumnMapping createMappingForAliased(SelectorName viewAlias, Schemata.View view, PlanNode viewPlan)
static List<Column> findRequiredColumns(QueryContext context, PlanNode planNode)
          Collected the minimum set of columns from the supplied table that are required by or used within the plan at the supplied node or above.
static List<String> findRequiredColumnTypes(QueryContext context, List<Column> columns, PlanNode node)
static Constraint replaceReferences(QueryContext context, Constraint constraint, PlanUtil.ColumnMapping mapping, PlanNode node)
static Constraint replaceReferencesToRemovedSource(QueryContext context, Constraint constraint, Map<SelectorName,SelectorName> rewrittenSelectors)
static DynamicOperand replaceReferencesToRemovedSource(QueryContext context, DynamicOperand operand, Map<SelectorName,SelectorName> rewrittenSelectors)
static JoinCondition replaceReferencesToRemovedSource(QueryContext context, JoinCondition joinCondition, Map<SelectorName,SelectorName> rewrittenSelectors)
static void replaceReferencesToRemovedSource(QueryContext context, PlanNode planNode, Map<SelectorName,SelectorName> rewrittenSelectors)
static Constraint replaceSubqueriesWithBindVariables(QueryContext context, Constraint constraint, Map<String,Subquery> subqueriesByVariableName)
static StaticOperand replaceSubqueriesWithBindVariables(QueryContext context, StaticOperand staticOperand, Map<String,Subquery> subqueriesByVariableName)
static DynamicOperand replaceViewReferences(QueryContext context, DynamicOperand operand, PlanUtil.ColumnMapping mapping, PlanNode node)
static JoinCondition replaceViewReferences(QueryContext context, JoinCondition joinCondition, PlanUtil.ColumnMapping mapping, PlanNode node)
static void replaceViewReferences(QueryContext context, PlanNode topOfViewInPlan, PlanUtil.ColumnMapping mappings)
protected static void replaceViewReferences(QueryContext context, PlanNode node, PlanUtil.ColumnMapping mappings, SelectorName viewName, List<PlanNode> potentiallyRemovableSources)
static void setSelectorsOnSubplan(PlanNode subplan, Set<SelectorName> selectors)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PlanUtil()
Method Detail


public static List<Column> findRequiredColumns(QueryContext context,
                                               PlanNode planNode)
Collected the minimum set of columns from the supplied table that are required by or used within the plan at the supplied node or above. This method first looks to see if the supplied node is a PlanNode.Type.PROJECT node, and if so immediately returns that node's list of projected columns. Otherwise, this method finds all of the PlanNode.Type.SOURCE nodes below the supplied plan node, and accumulates the set of sources for which the columns are to be found. The method then walks up the plan, looking for references to columns of the supplied table, starting with the supplied node and walking up until a PROJECT node is found or the top of the plan is reached.

The resulting column list will always contain at the front the columns from the nearest PROJECT ancestor, followed by any columns required by criteria. This is done so that the processing of the nearest PROJECT ancestor node can simply use the sublist of each tuple.

context - the query context; may not be null
planNode - the plan node at which the required columns need to be found; may not be null
the list of Column objects that are used in the plan; never null but possibly empty if no columns are actually needed


public static List<String> findRequiredColumnTypes(QueryContext context,
                                                   List<Column> columns,
                                                   PlanNode node)


public static void replaceReferencesToRemovedSource(QueryContext context,
                                                    PlanNode planNode,
                                                    Map<SelectorName,SelectorName> rewrittenSelectors)


public static DynamicOperand replaceReferencesToRemovedSource(QueryContext context,
                                                              DynamicOperand operand,
                                                              Map<SelectorName,SelectorName> rewrittenSelectors)


public static Constraint replaceReferencesToRemovedSource(QueryContext context,
                                                          Constraint constraint,
                                                          Map<SelectorName,SelectorName> rewrittenSelectors)


public static JoinCondition replaceReferencesToRemovedSource(QueryContext context,
                                                             JoinCondition joinCondition,
                                                             Map<SelectorName,SelectorName> rewrittenSelectors)


public static void replaceViewReferences(QueryContext context,
                                         PlanNode topOfViewInPlan,
                                         PlanUtil.ColumnMapping mappings)


protected static void replaceViewReferences(QueryContext context,
                                            PlanNode node,
                                            PlanUtil.ColumnMapping mappings,
                                            SelectorName viewName,
                                            List<PlanNode> potentiallyRemovableSources)


public static Constraint replaceReferences(QueryContext context,
                                           Constraint constraint,
                                           PlanUtil.ColumnMapping mapping,
                                           PlanNode node)


public static DynamicOperand replaceViewReferences(QueryContext context,
                                                   DynamicOperand operand,
                                                   PlanUtil.ColumnMapping mapping,
                                                   PlanNode node)


public static JoinCondition replaceViewReferences(QueryContext context,
                                                  JoinCondition joinCondition,
                                                  PlanUtil.ColumnMapping mapping,
                                                  PlanNode node)


public static PlanUtil.ColumnMapping createMappingFor(Schemata.View view,
                                                      PlanNode viewPlan)


public static PlanUtil.ColumnMapping createMappingForAliased(SelectorName viewAlias,
                                                             Schemata.View view,
                                                             PlanNode viewPlan)


public static PlanUtil.ColumnMapping createMappingForAliased(SelectorName tableAlias,
                                                             Schemata.Table table,
                                                             PlanNode tableSourceNode)


public static void setSelectorsOnSubplan(PlanNode subplan,
                                         Set<SelectorName> selectors)


public static Constraint replaceSubqueriesWithBindVariables(QueryContext context,
                                                            Constraint constraint,
                                                            Map<String,Subquery> subqueriesByVariableName)


public static StaticOperand replaceSubqueriesWithBindVariables(QueryContext context,
                                                               StaticOperand staticOperand,
                                                               Map<String,Subquery> subqueriesByVariableName)

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